summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/proof-at-the-end
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-05-22 21:24:20 +0000
committerKarl Berry <karl@freefriends.org>2019-05-22 21:24:20 +0000
commitf929c20d33a17779b7d3f747774edd4082bdac44 (patch)
tree2b7a29575d2ca0f69c91a986412438667ea6fbc5 /Master/texmf-dist/tex/latex/proof-at-the-end
parentc172740adc810b1dfcf73516eb7c28292ab267d5 (diff)
proof-at-the-end (22may19)
git-svn-id: svn://tug.org/texlive/trunk@51194 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/proof-at-the-end')
-rw-r--r--Master/texmf-dist/tex/latex/proof-at-the-end/proof-at-the-end.sty53
1 files changed, 31 insertions, 22 deletions
diff --git a/Master/texmf-dist/tex/latex/proof-at-the-end/proof-at-the-end.sty b/Master/texmf-dist/tex/latex/proof-at-the-end/proof-at-the-end.sty
index 97c7ce1e63b..66a27077b5e 100644
--- a/Master/texmf-dist/tex/latex/proof-at-the-end/proof-at-the-end.sty
+++ b/Master/texmf-dist/tex/latex/proof-at-the-end/proof-at-the-end.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{proof-at-the-end}[2019/05/06 A package to move proofs in appendix]
+\ProvidesPackage{proof-at-the-end}[2019/05/21 A package to move proofs in appendix]
\RequirePackage{etoolbox}
\RequirePackage{hyperref}
@@ -65,7 +65,8 @@
\newwrite\appendwrite
-\newcommand*\appendtofile[2]{%
+
+\NewDocumentCommand\appendtofile{m+m}{%
\begingroup
\IfFileExists{#1}%
{\CatchFileDef{\filecontent}{#1}{\catcode`\\=12 \endlinechar=`^^J\catcode\endlinechar=12\relax}}% keep existing end-of-lines
@@ -75,6 +76,7 @@
\immediate\closeout\appendwrite
\endgroup
}
+
%% This functions takes one input: the category (without .tex),
%% If it's the first time we write in this
%% category file, it "blanks" it.
@@ -82,7 +84,7 @@
\newcommand*\eraseIfNeeded[1]{%
% A macro 'pratendmacrocat{category}' is created to check
% if it's the first time we write in this category file.
- \edef\macroname{pratendmacrocat#1}%
+ \protected@edef\macroname{pratendmacrocat#1}%
\ifcsdef{\macroname}{% The macro exists, nothing to do
}{ % The macro does not exists, create it, and empty the file
\global\expandafter\def\csname \macroname\endcsname{true}%
@@ -127,7 +129,7 @@
%% to make sure the proof for normal theorems are changed
text proof/.code={\def\pratendtextproof{#1}},
%% Custom restate command
- restate command/.code={\edef\pratendcustomrestate{#1}},
+ restate command/.code={\protected@edef\pratendcustomrestate{#1}},
%% (Re)stated before
%% If the theorems has been stated before, then we just need to put the restate command in
%% place of the argument, and we set this value to true:
@@ -175,19 +177,25 @@
stared
},
see full proof/.style={
- text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}}
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}
},
one big link/.style={
text link={\hyperref[proof:prAtEnd\pratendcountercurrent] {#1}}
},
one big link/.default={%
- See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}
+ See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}.
},
one big link translated/.style={
- one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}}
+ one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}.}
+ },
+ text link section/.style={%
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}
+ },
+ text link section full proof/.style={%
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \autoref{proofsection:prAtEnd\pratendcountercurrent}.}
},
default text link/.style={
- text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}},
+ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.},
},
text proof translated/.style={
text proof={#1 \string\autoref{thm:prAtEnd\pratendcountercurrent}},
@@ -240,13 +248,13 @@
\NewDocumentEnvironment{theoremEndRestateBefore}{mO{}m+b}{
\stepcounter{counterAllProofEnd}%
- \edef\currcounterval{\roman{counterAllProofEnd}}
- \edef\temprest{\noexpand\begin{restatable*}[#2]{#1}{prAtEndRestate\currcounterval}\noexpand\label{thm:prAtEnd\currcounterval}}%
- \global\expandafter\edef\csname #3\endcsname{\currcounterval}%
+ \protected@edef\currcounterval{\roman{counterAllProofEnd}}
+ \protected@edef\temprest{\noexpand\begin{restatable*}[#2]{#1}{prAtEndRestate\currcounterval}\noexpand\label{thm:prAtEnd\currcounterval}}%
+ \expandafter\protected@xdef\csname #3\endcsname{\currcounterval}%
\temprest%
#4%
\end{restatable*}%
-}
+}{}
\NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{
% The first facultative argument will be the options: type of proof you want, the file to which you want to write...
@@ -261,15 +269,16 @@
#1
}%
\stepcounter{counterAllProofEnd}%
- %% Pre-expand the restatable environment
- \edef\temprest{\noexpand\begin{restatable}[#3]{#2}{prAtEndRestate\roman{counterAllProofEnd}}}%
+ %% Pre-expand the restatable environment. Need protected
+ %% otherwise can't have $\mathtt{G}$ in the title
+ \protected@edef\temprest{\noexpand\begin{restatable}[#3]{#2}{prAtEndRestate\roman{counterAllProofEnd}}}%
%% Create the file if it's the first time
\eraseIfNeeded{\category}%
%% If the theorem must be written here:
\unless\ifallattheend%
%% Restate the theorem if it was stated before:
\ifrestatedbefore%
- \global\edef\pratendcountercurrent{\csname #4\endcsname} % Store the current (alpha value of the) counter
+ \protected@xdef\pratendcountercurrent{\csname #4\endcsname} % Store the current (alpha value of the) counter
\csname prAtEndRestate\pratendcountercurrent\endcsname % Restate the theorem
\fi%
%% Otherwise just state the theorem in a restatable environment
@@ -280,10 +289,10 @@
\end{restatable}%
%% Store the current (alpha value of the) counter
%% in \pratendcountercurrent
- \global\edef\pratendcountercurrent{\roman{counterAllProofEnd}} %
+ \protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} %
\fi%
%% Create a custom alias to restate the theorem
- \global\expandafter\edef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
+ \expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
%% Restate the theorem if needed in appendix
\ifrestatethm
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}
@@ -294,12 +303,12 @@
\ifallattheend%
%% Store the current (alpha value of the) counter
%% in \pratendcountercurrent
- \global\edef\pratendcountercurrent{\roman{counterAllProofEnd}}
+ \protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}}
%% Create a custom alias to restate the theorem
- \global\expandafter\edef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
+ \expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}%
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[#3]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}%
\fi%
-}
+}{}
\NewDocumentEnvironment{proofEnd}{O{}+b}{
\pgfkeys{%
@@ -323,9 +332,9 @@
\fi%
%% Write the proof at the end
\ifproofend%
- \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{proof}[\pratendtextproof]\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}\detokenize{#2}\string\end{proof}}%
+ \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\label{proofsection:prAtEnd\pratendcountercurrent}\string\begin{proof}[\pratendtextproof]\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}\detokenize{#2}\string\end{proof}}%
\fi%
-}
+}{}
%%%%% Text in appendix