diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-22 21:24:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-22 21:24:20 +0000 |
commit | f929c20d33a17779b7d3f747774edd4082bdac44 (patch) | |
tree | 2b7a29575d2ca0f69c91a986412438667ea6fbc5 /Master/texmf-dist/source/latex | |
parent | c172740adc810b1dfcf73516eb7c28292ab267d5 (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/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.dtx | 127 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins | 2 |
2 files changed, 90 insertions, 39 deletions
diff --git a/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.dtx b/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.dtx index 92ac34abbbb..91d02323a11 100644 --- a/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.dtx +++ b/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.dtx @@ -1,12 +1,12 @@ %\iffalse % proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: +% -doc "../doc/proof-at-the-end_doc.tex" % -author "Léo Colisson" +% -dir "/tmp/pat/proof-at-the-end/" % -src "proof-at-the-end\.sty=>proof-at-the-end.sty" -% -doc "../doc/proof-at-the-end_doc.tex" -% -dir "/home/leo/Documents/Work_in_progress_Git/proof-at-the-end/" % proof-at-the-end -% Created on 2019/5/7 12:29 +% Created on 2019/5/22 12:52 %\fi %\iffalse %<*package> @@ -193,7 +193,8 @@ % %Disclaimer: This package is still in beta and not considered as stable. % -%This package is licensed under LPPL v1.3. +%This package is licensed under LPPL v1.3, and the last version of this +%package on CTAN is 2019/05/21. % %\hypertarget{demo}{% %\section{Demo}\label{demo}} @@ -234,6 +235,30 @@ %\end{Highlighting} %\end{Shaded} % +%If you have an old distribution of LaTeX (before 2018 basically, which +%is the case of Overleaf), you may also need a +%\href{https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1\#comment1236409_489649}{more +%recent expl3}. It is also very easy to install, just download the zip +%file +%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip}, +%unzip, and copy the content of the directory +%\texttt{tex/latex/l3kernel/} into your project. On linux it's a matter +%of two commands in your project: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip} +%\FunctionTok{unzip}\NormalTok{ -d . -j l3kernel.tds.zip }\StringTok{'tex/latex/l3kernel/*'} +%\FunctionTok{rm}\NormalTok{ l3kernel.tds.zip} +%\end{Highlighting} +%\end{Shaded} +% +%If you don't want to pollute your main project with all these files, you +%may be interested to put them in a subfolder and update the environment +%variable \texttt{TEXINPUTS} or, if you use latexmk or overleaf, you can +%write instead a \texttt{latexmkrc} file as explained +%\href{https://www.overleaf.com/learn/latex/Questions/I_have_a_lot_of_.cls,_.sty,_.bst_files,_and_I_want_to_put_them_in_a_folder_to_keep_my_project_uncluttered._But_my_project_is_not_finding_them_to_compile_correctly}{here}. +% %That's all! % %\hypertarget{use-in-your-project}{% @@ -412,12 +437,13 @@ % \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[normal,#2]\{thm\}[#1]}\CommentTok{%} %\NormalTok{ #3}\CommentTok{%} % \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}}\CommentTok{%} -%\NormalTok{\}} +%\NormalTok{\}\{\}} +%\CommentTok{% Do not forget the second parameter or you might get Missing \textbackslash{}begin\{document\} error} %\FunctionTok{\textbackslash{}NewDocumentEnvironment}\NormalTok{\{proofE\}\{O\{\}+b\}\{}\CommentTok{%} % \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}[#1]}\CommentTok{%} %\NormalTok{ #2}\CommentTok{%} % \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}}\CommentTok{%} -%\NormalTok{\}} +%\NormalTok{\}\{\}} %\end{Highlighting} %\end{Shaded} % @@ -482,11 +508,17 @@ % lost at the next compilation}!). %\item % \texttt{one\ big\ link}: if you prefer to have a single big link -% instead of two links (one for the proof one for the page) +% instead of two links (one for the proof, one for the page) %\item % \texttt{one\ big\ link\ translated=Your\ translation}: to % change/translate the text of the link easily %\item +% \texttt{text\ link\ section}: put a link looking like ``See proof in +% section XX.'' +%\item +% \texttt{text\ link\ section\ full\ proof}: put a link looking like +% ``See full proof in section XX.'' +%\item % \texttt{text\ proof\ translated=Your\ translation}: to % change/translate the text of the proof at the end easily %\item @@ -519,8 +551,8 @@ %\end{Highlighting} %\end{Shaded} % -%and give in the section where you would like to display the proofs the -%code this category name to \texttt{\textbackslash{}printProofs}: +%and give this category name to \texttt{\textbackslash{}printProofs} in +%the section where you would like to display the proofs: % %\begin{Shaded} %\begin{Highlighting}[] @@ -535,7 +567,7 @@ % %\begin{Shaded} %\begin{Highlighting}[] -%\FunctionTok{\textbackslash{}textEnd}\NormalTok{\{You text that should go in appendix\}} +%\FunctionTok{\textbackslash{}textEnd}\NormalTok{\{Your text that should go in appendix\}} %\end{Highlighting} %\end{Shaded} % @@ -633,7 +665,7 @@ %You can include a sketch of proof in the main text by simply adding a %proof in between \texttt{theoremEnd} and \texttt{proofEnd}. An alias %option \texttt{see\ full\ proof} can also be used to change the link -%into ``See full proof on page X'': +%into ``See full proof on page X.'': % %\begin{Shaded} %\begin{Highlighting}[] @@ -679,7 +711,7 @@ %\item % \texttt{text\ link}: text of the link to the proof, defaults to % -% \texttt{\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}\}} +% \texttt{\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} %\item % \texttt{text\ proof}: text displayed in place of ``Proof'' in the % appendix. Defaults to @@ -738,14 +770,14 @@ %\item % \texttt{see\ full\ proof}: useful when you want to write in the main % text only a sketch of proof, this alias writes a link -% \texttt{See\ full\ proof\ on\ page\ X}. Equivalent to -% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}\}} +% \texttt{See\ full\ proof\ on\ page\ X.}. Equivalent to +% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} %\item % \texttt{one\ big\ link}: instead of two links, one for page, one for % proof, put just one link around everything. It can also accept an % optional argument which will be the text of the link, like % \texttt{one\ big\ link=Go\ to\ the\ proof}. The default value is -% \texttt{See\ proof\ on\ page\textasciitilde{}\textbackslash{}pageref*\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}}. +% \texttt{See\ proof\ on\ page\textasciitilde{}\textbackslash{}pageref*\{proof:prAtEnd\textbackslash{}pratendcountercurrent.\}}. %\item % \texttt{one\ big\ link\ translated}: This is like % \texttt{one\ big\ link}, but automatically add the page at the end @@ -753,9 +785,17 @@ % like \texttt{one\ big\ link\ translated=Voir\ preuve\ page}. See also % \texttt{text\ proof\ translated}. %\item +% \texttt{text\ link\ section}: Put a link to the proof looking like +% ``See proof in section X''. Defaults to +% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ in\ \textbackslash{}autoref\{proofsection:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} +%\item +% \texttt{text\ link\ section\ full\ proof}: Put a link to the proof +% looking like ``See full proof in section X''. Defaults to +% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ in\ \textbackslash{}autoref\{proofsection:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} +%\item % \texttt{default\ text\ link}: default text for the link to the proof, % equivalent of -% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}\}} +% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} %\item % \texttt{default\ text\ proof}: default text for the proof in appendix, % equivalent of @@ -818,7 +858,7 @@ % \end{macrocode} %\fi \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} @@ -846,7 +886,10 @@ % \ProcessOptions\relax \newwrite\appendwrite -\newcommand*\appendtofile[2]{% + +% The first argument is the file name +% The second argument is the text to write +\NewDocumentCommand\appendtofile{m+m}{% \begingroup \IfFileExists{#1}% {\CatchFileDef{\filecontent}{#1}{\catcode`\\=12 \endlinechar=`^^J\catcode\endlinechar=12\relax}}% keep existing end-of-lines @@ -856,6 +899,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. @@ -863,7 +907,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}% @@ -908,7 +952,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: @@ -956,19 +1000,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}}, @@ -1021,13 +1071,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... @@ -1042,15 +1092,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 @@ -1061,10 +1112,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*} @@ -1075,12 +1126,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{% @@ -1104,9 +1155,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 diff --git a/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins b/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins index db0365abbe5..0daebc328f6 100644 --- a/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins +++ b/Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins @@ -1,4 +1,4 @@ -% proof-at-the-end.ins generated using makedtx version 1.2 2019/5/7 12:29 +% proof-at-the-end.ins generated using makedtx version 1.2 2019/5/22 12:52 \input docstrip \preamble |