How to define new environment, using proof-environment












1















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.











share|improve this question

























  • 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
    9 hours ago
















1















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.











share|improve this question

























  • 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
    9 hours ago














1












1








1








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.











share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 8 hours ago









Bernard

172k775203




172k775203










asked 9 hours ago









Mundron SchmidtMundron Schmidt

1255




1255













  • 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
    9 hours 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
    9 hours 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
9 hours 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
9 hours ago










1 Answer
1






active

oldest

votes


















4














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}


enter image description here



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}


enter image description here



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}





share|improve this answer


























  • 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
    8 hours 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
    8 hours 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
    8 hours ago











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
});


}
});














draft saved

draft discarded


















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









4














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}


enter image description here



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}


enter image description here



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}





share|improve this answer


























  • 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
    8 hours 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
    8 hours 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
    8 hours ago
















4














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}


enter image description here



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}


enter image description here



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}





share|improve this answer


























  • 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
    8 hours 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
    8 hours 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
    8 hours ago














4












4








4







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}


enter image description here



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}


enter image description here



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}





share|improve this answer















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}


enter image description here



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}


enter image description here



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}






share|improve this answer














share|improve this answer



share|improve this answer








edited 9 hours ago

























answered 9 hours 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
    8 hours 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
    8 hours 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
    8 hours 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
    8 hours 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
    8 hours 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
    8 hours 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
8 hours 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
8 hours 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
8 hours 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
8 hours 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
8 hours 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
8 hours ago


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

GameSpot

日野市

Tu-95轟炸機