use translation package in proof.pysty for easy translations

This commit is contained in:
Maximilian Keßler 2022-01-09 13:11:01 +01:00
parent 6f88fd20f0
commit 06965d4a3a
2 changed files with 63 additions and 24 deletions

View file

@ -2,6 +2,7 @@ __HEADER__(Automatic references to theorems in proofs. Claim counters within pro
\RequirePackage{xkeyval} \RequirePackage{xkeyval}
\RequirePackage{refcount} \RequirePackage{refcount}
\RequirePackage{translator}
__LANGUAGE_OPTIONS_X__ __LANGUAGE_OPTIONS_X__
@ -12,12 +13,57 @@ __END_OPTIONS_X__
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{xparse} \RequirePackage{xparse}
\newtranslation[to = English]{Claim}{Claim}
\newtranslation[to = German]{Claim}{Behauptung}
\newtranslation[to = English]{claim}{claim}
\newtranslation[to = German]{claim}{Behauptung}
\newtranslation[to = English]{Proof}{Proof}
\newtranslation[to = German]{Proof}{Beweis}
\newtranslation[to = English]{proof}{proof}
\newtranslation[to = German]{proof}{Beweis}
\newtranslation[to = English]{Proof*}{Proof*}
\newtranslation[to = German]{Proof*}{Beweis*}
\newtranslation[to = English]{proof*}{proof*}
\newtranslation[to = German]{proof*}{Beweis*}
\newtranslation[to = English]{Proof of}{Proof of}
\newtranslation[to = German]{Proof of}{Beweis von}
\newtranslation[to = English]{proof of}{proof of}
\newtranslation[to = German]{proof of}{Beweis von}
\newtranslation[to = English]{Proof* of}{Proof* of}
\newtranslation[to = German]{Proof* of}{Beweis* von}
\newtranslation[to = English]{proof* of}{proof* of}
\newtranslation[to = German]{proof* of}{Beweis* von}
\newtranslation[to = English]{Continuation of proof}{Continuation of proof}
\newtranslation[to = German]{Continuation of proof}{Fortsetzung des Beweises}
\newtranslation[to = English]{continuation of proof}{continuation of proof}
\newtranslation[to = German]{continuation of proof}{Fortsetzung des Beweises}
\newtranslation[to = English]{Continuation of proof of}{Continuation of proof of}
\newtranslation[to = German]{Continuation of proof of}{Fortsetzung des Beweises zu}
\newtranslation[to = English]{continuation of proof of}{continuation of proof of}
\newtranslation[to = German]{continuation of proof of}{Fortsetzung des Beweises zu}
\newtranslation[to = English]{Continuation of proof*}{Continuation of proof*}
\newtranslation[to = German]{Continuation of proof*}{Fortsetzung des Beweises*}
\newtranslation[to = English]{continuation of proof*}{continuation of proof*}
\newtranslation[to = German]{continuation of proof*}{Fortsetzung des Beweises*}
\newtranslation[to = English]{Continuation of proof* of}{Continuation of proof* of}
\newtranslation[to = German]{Continuation of proof* of}{Fortsetzung des Beweises* zu}
\newtranslation[to = English]{continuation of proof* of}{continuation of proof* of}
\newtranslation[to = German]{continuation of proof* of}{Fortsetzung des Beweises* zu}
%%Give claim an own counter and let it reset at each proof %%Give claim an own counter and let it reset at each proof
%See also at: %See also at:
%https://tex.stackexchange.com/questions/283502/reset-counter-at-beginning-of-proof %https://tex.stackexchange.com/questions/283502/reset-counter-at-beginning-of-proof
\newtheorem{claim}{__IF__(english) Claim\else Behauptung\fi} \newtheorem{claim}{\translate{Claim}}
\newtheorem*{claim*}{__IF__(english) Claim\else Behauptung\fi} \newtheorem*{claim*}{\translate{Claim}}
\AtBeginDocument{\def\claimautorefname{__IF__(english) Claim\else Behauptung\fi}} \AtBeginDocument{\def\claimautorefname{\translate{Claim}}}
__NEW_IF__(hyperref,false) __NEW_IF__(hyperref,false)
\AtBeginDocument{ \AtBeginDocument{
@ -38,11 +84,11 @@ __NEW_IF__(hyperref,false)
% Restore correct counter for claim % Restore correct counter for claim
\ifcsdef{the__PACKAGE_PREFIX__#2@save@claim}{ \ifcsdef{the__PACKAGE_PREFIX__#2@save@claim}{
\setcounter{claim}{\value{__PACKAGE_PREFIX__#2@save@claim}} \setcounter{claim}{\value{__PACKAGE_PREFIX__#2@save@claim}}
\def__PACKAGE_MACRO__(proofprefix){__IF__(english) Continuation of proof\IfBooleanT{#1}{*}\space of\else Fortsetzung des Beweises\IfBooleanT{#1}{*}\space zu\fi} \def__PACKAGE_MACRO__(proofprefix){\IfBooleanTF{#1}{\translate{Continuation of proof* of}}{\translate{Continuation of proof of}}}
}{ }{
\newcounter{__PACKAGE_PREFIX__#2@save@claim} \newcounter{__PACKAGE_PREFIX__#2@save@claim}
\setcounter{claim}{0} \setcounter{claim}{0}
\def__PACKAGE_MACRO__(proofprefix){__IF__(english) Proof\ifBooleanT{#1}{*}\space of\else Beweis\IfBooleanT{#1}{*}\space von\fi} \def__PACKAGE_MACRO__(proofprefix){\IfBooleanTF{#1}{\translate{Proof* of}}{\translate{Proof of}}}
} }
% Set up counter number printing as subindexed by numbering of the reference % Set up counter number printing as subindexed by numbering of the reference
\let__PACKAGE_MACRO__(theoldclaim)\theclaim \let__PACKAGE_MACRO__(theoldclaim)\theclaim
@ -60,23 +106,15 @@ __NEW_IF__(hyperref,false)
\AtBeginDocument{ \AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o} \RenewDocumentEnvironment{proof}{s o}
{ {
\IfNoValueTF{#2}{ __PACKAGE_MACRO__(saved@proof)[\IfBooleanTF{#1}{\translate{Proof*}}{\translate{Proof}}\IfValueT{#2}{\space(#2)}]
__PACKAGE_MACRO__(saved@proof)[
__IF__(english)
Proof\IfBooleanT{#1}{\emph{*}}
\else
Beweis\IfBooleanT{#1}{\emph{*}}
\fi
]
}{
__PACKAGE_MACRO__(saved@proof)[__IF__(english) Proof\else Beweis\fi\IfBooleanT{#1}{\emph{*}}\space(#2)]
}
} }
{ {
__PACKAGE_MACRO__(saved@endproof) __PACKAGE_MACRO__(saved@endproof)
} }
} }
\NewDocumentEnvironment{oldproof}{}{__PACKAGE_MACRO__(saved@proof)}{__PACKAGE_MACRO__(saved@endproof)}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol %%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{% \DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed \ifmmode \mathqed

View file

@ -1,5 +1,6 @@
\documentclass[german]{article} \documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{mkessler-proof} \usepackage{mkessler-proof}
\usepackage{mkessler-fancythm} \usepackage{mkessler-fancythm}
\usepackage{mkessler-hypersetup} \usepackage{mkessler-hypersetup}
@ -45,21 +46,21 @@ Nun kommen wir wieder zurück zum eigentlichen Beweis:
Aus \autoref{cl:qed} und \autoref{cl:würzburg} folgt nun die Aussage. Aus \autoref{cl:qed} und \autoref{cl:würzburg} folgt nun die Aussage.
\end{refproof} \end{refproof}
a
\begin{proof}
first
\end{proof}
a
\begin{proof}[anm] \begin{proof}[anm]
second second
\end{proof} \end{proof}
a \begin{proof}
first
\end{proof}
\begin{proof}* \begin{proof}*
third third
\end{proof} \end{proof}
a
\begin{proof}*[anm] \begin{proof}*[anm]
fourth fourth
\end{proof} \end{proof}
\begin{oldproof}
test
\end{oldproof}
\end{document} \end{document}