How to define new environment, using proof-environment
I'm using the package amsthm and I like to define my own proof environment, where the title proof is replaced by Beweis.
So far, I tried
newenvironment{bew}{begin{proof}[textsc{textbf{Beweis:}}]}{end{proof}}
and this works fine. But now I like to improve the environment so that the argument should stay between Beweis and :
For example
begin{bew}[von Theorem 2.1]
Nice proof.
end{bew}
should look like
Beweis von Theorem 2.1: Nice proof.
theorems amsthm
add a comment |
I'm using the package amsthm and I like to define my own proof environment, where the title proof is replaced by Beweis.
So far, I tried
newenvironment{bew}{begin{proof}[textsc{textbf{Beweis:}}]}{end{proof}}
and this works fine. But now I like to improve the environment so that the argument should stay between Beweis and :
For example
begin{bew}[von Theorem 2.1]
Nice proof.
end{bew}
should look like
Beweis von Theorem 2.1: Nice proof.
theorems amsthm
The text "Proof" is provided byproofname, so all you need to do isrenewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.
– barbara beeton
1 hour ago
add a comment |
I'm using the package amsthm and I like to define my own proof environment, where the title proof is replaced by Beweis.
So far, I tried
newenvironment{bew}{begin{proof}[textsc{textbf{Beweis:}}]}{end{proof}}
and this works fine. But now I like to improve the environment so that the argument should stay between Beweis and :
For example
begin{bew}[von Theorem 2.1]
Nice proof.
end{bew}
should look like
Beweis von Theorem 2.1: Nice proof.
theorems amsthm
I'm using the package amsthm and I like to define my own proof environment, where the title proof is replaced by Beweis.
So far, I tried
newenvironment{bew}{begin{proof}[textsc{textbf{Beweis:}}]}{end{proof}}
and this works fine. But now I like to improve the environment so that the argument should stay between Beweis and :
For example
begin{bew}[von Theorem 2.1]
Nice proof.
end{bew}
should look like
Beweis von Theorem 2.1: Nice proof.
theorems amsthm
theorems amsthm
edited 56 mins ago
Bernard
172k775203
172k775203
asked 1 hour ago
Mundron SchmidtMundron Schmidt
1255
1255
The text "Proof" is provided byproofname, so all you need to do isrenewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.
– barbara beeton
1 hour ago
add a comment |
The text "Proof" is provided byproofname, so all you need to do isrenewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.
– barbara beeton
1 hour ago
The text "Proof" is provided by
proofname, so all you need to do is renewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.– barbara beeton
1 hour ago
The text "Proof" is provided by
proofname, so all you need to do is renewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.– barbara beeton
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
What you need is just changing the period with a colon. Unfortunately, amsmath hardwires the period, so we need to patch proof in order to remove the dependency.
The name will switch to “Beweis” as soon as you load babel with an option for German, usually ngerman if you adhere to the “neue Rechtschreibung”.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
newcommand{proofpunctuation}{:} % change to your liking
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
end{document}

The input
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
will produce the expected result.
If you prefer boldface, another patch is in order.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}

If your font supports boldface small caps (few fonts do), you can say
newcommand{prooffont}{scshapebfseries}
A syntax such as begin{proof}[von Satz 1] to automatically supply “Beweis” could be done too, but I'd not do it.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
xpatchcmd{proof}{#1}{proofnameifxproofname#1else #1fi}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}
You can also do with a new environment, which avoids patching.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xparse}
NewDocumentEnvironment{bew}{o}
{proof[normalfontbfseriesproofnameIfValueT{#1}{ #1}:]}
{endproof}
begin{document}
begin{bew}
Das ist ein schöner Beweis.
end{bew}
begin{bew}[von Satz 1]
Das ist ein schöner Beweis.
end{bew}
end{document}
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)sfcode`:=1000. But in that case you would get the period also without the optional argument.
– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477475%2fhow-to-define-new-environment-using-proof-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What you need is just changing the period with a colon. Unfortunately, amsmath hardwires the period, so we need to patch proof in order to remove the dependency.
The name will switch to “Beweis” as soon as you load babel with an option for German, usually ngerman if you adhere to the “neue Rechtschreibung”.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
newcommand{proofpunctuation}{:} % change to your liking
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
end{document}

The input
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
will produce the expected result.
If you prefer boldface, another patch is in order.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}

If your font supports boldface small caps (few fonts do), you can say
newcommand{prooffont}{scshapebfseries}
A syntax such as begin{proof}[von Satz 1] to automatically supply “Beweis” could be done too, but I'd not do it.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
xpatchcmd{proof}{#1}{proofnameifxproofname#1else #1fi}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}
You can also do with a new environment, which avoids patching.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xparse}
NewDocumentEnvironment{bew}{o}
{proof[normalfontbfseriesproofnameIfValueT{#1}{ #1}:]}
{endproof}
begin{document}
begin{bew}
Das ist ein schöner Beweis.
end{bew}
begin{bew}[von Satz 1]
Das ist ein schöner Beweis.
end{bew}
end{document}
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)sfcode`:=1000. But in that case you would get the period also without the optional argument.
– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
add a comment |
What you need is just changing the period with a colon. Unfortunately, amsmath hardwires the period, so we need to patch proof in order to remove the dependency.
The name will switch to “Beweis” as soon as you load babel with an option for German, usually ngerman if you adhere to the “neue Rechtschreibung”.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
newcommand{proofpunctuation}{:} % change to your liking
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
end{document}

The input
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
will produce the expected result.
If you prefer boldface, another patch is in order.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}

If your font supports boldface small caps (few fonts do), you can say
newcommand{prooffont}{scshapebfseries}
A syntax such as begin{proof}[von Satz 1] to automatically supply “Beweis” could be done too, but I'd not do it.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
xpatchcmd{proof}{#1}{proofnameifxproofname#1else #1fi}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}
You can also do with a new environment, which avoids patching.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xparse}
NewDocumentEnvironment{bew}{o}
{proof[normalfontbfseriesproofnameIfValueT{#1}{ #1}:]}
{endproof}
begin{document}
begin{bew}
Das ist ein schöner Beweis.
end{bew}
begin{bew}[von Satz 1]
Das ist ein schöner Beweis.
end{bew}
end{document}
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)sfcode`:=1000. But in that case you would get the period also without the optional argument.
– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
add a comment |
What you need is just changing the period with a colon. Unfortunately, amsmath hardwires the period, so we need to patch proof in order to remove the dependency.
The name will switch to “Beweis” as soon as you load babel with an option for German, usually ngerman if you adhere to the “neue Rechtschreibung”.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
newcommand{proofpunctuation}{:} % change to your liking
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
end{document}

The input
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
will produce the expected result.
If you prefer boldface, another patch is in order.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}

If your font supports boldface small caps (few fonts do), you can say
newcommand{prooffont}{scshapebfseries}
A syntax such as begin{proof}[von Satz 1] to automatically supply “Beweis” could be done too, but I'd not do it.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
xpatchcmd{proof}{#1}{proofnameifxproofname#1else #1fi}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}
You can also do with a new environment, which avoids patching.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xparse}
NewDocumentEnvironment{bew}{o}
{proof[normalfontbfseriesproofnameIfValueT{#1}{ #1}:]}
{endproof}
begin{document}
begin{bew}
Das ist ein schöner Beweis.
end{bew}
begin{bew}[von Satz 1]
Das ist ein schöner Beweis.
end{bew}
end{document}
What you need is just changing the period with a colon. Unfortunately, amsmath hardwires the period, so we need to patch proof in order to remove the dependency.
The name will switch to “Beweis” as soon as you load babel with an option for German, usually ngerman if you adhere to the “neue Rechtschreibung”.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
newcommand{proofpunctuation}{:} % change to your liking
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
end{document}

The input
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
will produce the expected result.
If you prefer boldface, another patch is in order.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[Beweis von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}

If your font supports boldface small caps (few fonts do), you can say
newcommand{prooffont}{scshapebfseries}
A syntax such as begin{proof}[von Satz 1] to automatically supply “Beweis” could be done too, but I'd not do it.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xpatch}
% we need to substitute . with a generic command
xpatchcmd{proof}{.}{proofpunctuation}{}{}
xpatchcmd{proof}{itshape}{prooffont}{}{}
xpatchcmd{proof}{#1}{proofnameifxproofname#1else #1fi}{}{}
newcommand{proofpunctuation}{:}
newcommand{prooffont}{bfseries}
begin{document}
begin{proof}
Das ist ein schöner Beweis.
end{proof}
begin{proof}[von Satz 1]
Das ist ein schöner Beweis.
end{proof}
end{document}
You can also do with a new environment, which avoids patching.
documentclass{article}
usepackage[T1]{fontenc}
usepackage[ngerman]{babel}
usepackage{amsthm}
usepackage{xparse}
NewDocumentEnvironment{bew}{o}
{proof[normalfontbfseriesproofnameIfValueT{#1}{ #1}:]}
{endproof}
begin{document}
begin{bew}
Das ist ein schöner Beweis.
end{bew}
begin{bew}[von Satz 1]
Das ist ein schöner Beweis.
end{bew}
end{document}
edited 1 hour ago
answered 1 hour ago
egregegreg
723k8819173221
723k8819173221
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)sfcode`:=1000. But in that case you would get the period also without the optional argument.
– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
add a comment |
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)sfcode`:=1000. But in that case you would get the period also without the optional argument.
– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
I really like your last example, because in that case I don't have to change all my enviroments :-) But begin{bew}[von Satz 1] give Beweis von Satz 1:. Somehow I get a point after the doublepoint.
– Mundron Schmidt
54 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)
sfcode`:=1000. But in that case you would get the period also without the optional argument.– egreg
51 mins ago
@MundronSchmidt I can only guess you tampered with space factor codes. This will happen if you set (or a package/class you load does)
sfcode`:=1000. But in that case you would get the period also without the optional argument.– egreg
51 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
Not sure, because a use copied a lot of code. But in that case I will use the first version. That works well. I thank you!
– Mundron Schmidt
41 mins ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477475%2fhow-to-define-new-environment-using-proof-environment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The text "Proof" is provided by
proofname, so all you need to do isrenewcommand{proofname}{Beweis}. You should be able to change the font too, if you want to.– barbara beeton
1 hour ago