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.

  • 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 Mar 2 at 21:01
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}{\scshape\bfseries}

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}{\proofname\ifx\proofname#1\else #1\fi}{}{}

\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[\normalfont\bfseries\proofname\IfValueT{#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 Mar 2 at 21:25
  • @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 Mar 2 at 21:28
  • 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 Mar 2 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.