diff options
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 | 318 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/proof-at-the-end/proof-at-the-end.ins | 2 |
2 files changed, 275 insertions, 45 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 d5f6ac4646c..8fee5c8ecdc 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: -% -author "Léo Colisson" +% -doc "../doc/proof-at-the-end_doc.tex" % -src "proof-at-the-end\.sty=>proof-at-the-end.sty" +% -author "Léo Colisson" % -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/" -% -doc "../doc/proof-at-the-end_doc.tex" % proof-at-the-end -% Created on 2022/2/1 17:07 +% Created on 2022/2/7 18:01 %\fi %\iffalse %<*package> @@ -169,20 +169,20 @@ % Move proofs in different places/sections by giving different % ``categories'' to the theorems %\item -% Create links from theorem to proof, and from proof to theorem +% Create links from theorem to proof, and from proof to theorem (and +% configure the text) %\item % Restate the theorem in appendix (or before) %\item -% Keep the proof in the main body like normal theorems by just adding -% with just one keyword +% Choose what you want to keep in the main text or in appendix (you can +% put in appendix either everything, just the proof, the theorem and the +% proof by keeping (or not) a copy in the body of the article\ldots) %\item % Duplicate the proof in appendix and in the current section, practical % to use synctex during the proof writting %\item -% Add comments that would appear only in the appendix (or in both body -% and appendix) -%\item -% Move both the theorem and the proof completely in appendix +% Add text that would appear only in the appendix (or in both body and +% appendix) %\item % Easily change the defaults, and create your own styles/environments %\item @@ -193,6 +193,9 @@ %\item % Have a nice environment-based commands in order to mimic the usual % theorem/proof structure. +%\item +% Separate the main article and the body in two documents (some journals +% may ask for a separate file for the appendix) %\end{itemize} % %NB: This project is hosted on github at @@ -529,7 +532,7 @@ %theorem/proof must be displayed by providing a value in %\texttt{OPTIONS}. For example, if you would like to keep the proof of a %theorem in the main text like any normal theorem, use the -%\texttt{normal} option: +%\texttt{normal} option. % %\begin{Shaded} %\begin{Highlighting}[] @@ -542,6 +545,52 @@ %\end{Highlighting} %\end{Shaded} % +%If you loaded the package using +%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}} +%(starting from 2022/01/28), you also have preconfigured shortcuts for +%multiple environments, namely \texttt{proofE} (to replace +%\texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), +%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), +%\texttt{lemmaE}, \texttt{propositionE}, \texttt{propertyE}, +%\texttt{factE} and \texttt{corollaryE}. This way, you can simplify the +%above as: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[A title][normal]} +%\NormalTok{ You can easily turn a theorem back into a normal theorem!} +%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} +%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} +%\NormalTok{ And keep the proof with you!} +%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} +%\end{Highlighting} +%\end{Shaded} +% +%(You can of course remove the \texttt{{[}...{]}} containing the options +%and the title, however if you want to add options without any title, +%\textbf{make sure to use empty brackets for the title}, like +%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}normal{]}}. +% +%Since 2022/01/28, you can also create new theorem environment that +%directly come with a preconfigured style (you may also find +%\texttt{\textbackslash{}pratendSetLocal} useful if you want to change +%the style in a whole section). For instance to create a +%\texttt{thmNormal} environment having the \texttt{normal} option and a +%\texttt{thmSpecial} environment having the +%\texttt{all\ end,\ category=mySpecial} options, just do: +% +%\begin{verbatim} +%\newEndThm[normal]{thmNormal}{thm} % 'thm' is the name of the existing thm environment +%\newEndThm[all end, category=mySpecial]{thmSpecial}{thm} +%\end{verbatim} +% +%This way, you can simply use +%\texttt{\textbackslash{}begin\{thmSpecial\}{[}Special\ title{]}\ ...\ \textbackslash{}end\{thmSpecial\}} +%to create a theorem going in the special category (see below). (you also +%have \texttt{\textbackslash{}newEndProof{[}options{]}\{newProofEnv\}} to +%define new proofs, but it is less useful as options are typically given +%in the theorem). +% %The options are in fact a set of keys/values, thanks to %\texttt{pgfkeys}. So you can combine them with comma separated list like %that (order matters, as the right-most values may overwrite @@ -600,6 +649,14 @@ %\end{Highlighting} %\end{Shaded} % +%or, for short (needs version \textgreater{} 2022/02/04): +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\FunctionTok{\textbackslash{}pratendSetGlobal}\NormalTok{\{one big link="blabla"\}} +%\end{Highlighting} +%\end{Shaded} +% %and for local configuration: % %\begin{Shaded} @@ -611,24 +668,14 @@ %\end{Highlighting} %\end{Shaded} % -%Finally, it can be practical to define custom environments to avoid -%typing always \texttt{theoremEnd} using something like that -%(\texttt{thmE} is the shortcut environment to create, and \texttt{thm} -%is the old one): +%for short (needs version \textgreater{} 2022/02/04): % %\begin{Shaded} %\begin{Highlighting}[] -%\FunctionTok{\textbackslash{}newEndThm}\NormalTok{[normal]\{thmE\}\{thm\}} -%\FunctionTok{\textbackslash{}newEndProof}\NormalTok{\{proofE\}} +%\FunctionTok{\textbackslash{}pratendSetLocal}\NormalTok{\{category=greattheorem\}} %\end{Highlighting} %\end{Shaded} % -%By default, loading the package using the \texttt{createShortEnv} option -%automatically creates the shortcut environments \texttt{proofE} (to -%replace \texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), -%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), -%\texttt{lemmaE} and \texttt{corollaryE}. -% %Then you can use like that: % %\begin{Shaded} @@ -656,11 +703,11 @@ %\end{Highlighting} %\end{Shaded} % -%Note also that it is also possible to give options to the -%\texttt{proofEnd} environment, but it is usually useless, as it will -%automatically pick the parameters from the last \texttt{theoremEnd} -%environment. However, if for some reasons you want to change the options -%of the proof only, you can do it, but do it as your own risks ;) +%Note also that it is possible to give options to the \texttt{proofEnd} +%environment, but it is usually useless, as it will automatically pick +%the parameters from the last \texttt{theoremEnd} environment. However, +%if for some reasons you want to change the options of the proof only, +%you can do it, but do it as your own risks ;) % %\hypertarget{usual-styles}{% %\subsection{Usual styles}\label{usual-styles}} @@ -686,7 +733,7 @@ % you use synctex with the proof in appendix, your will be unfortunately % moved to a temporary file that this library is using\ldots{} so % \textbf{make sure you don't modify the files named like -% \texttt{prattheenddefaultcategory.tex} or all your changes will be +% \texttt{*prattheenddefaultcategory.tex} or all your changes will be % lost at the next compilation}!). %\item % \texttt{one\ big\ link}: if you prefer to have a single big link @@ -696,7 +743,7 @@ % change/translate the text of the link easily %\item % \texttt{text\ link\ section}: put a link looking like ``See proof in -% section XX.'' +% section XX.''. You can use \texttt{text\ link=} to remove this link. %\item % \texttt{text\ link\ section\ full\ proof}: put a link looking like % ``See full proof in section XX.'' @@ -863,6 +910,55 @@ %\end{Highlighting} %\end{Shaded} % +%\hypertarget{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}{% +%\subsection{Split the article in two documents, one for the main body +%and one for the +%appendix}\label{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix}} +% +%Since 2022/02/04, it is possible to include the appendix in a separate +%file. Internally, this library creates a new file having the form +%\texttt{NAME\_OF\_FILE-pratendNAME\_CATEGORY.tex} containing the proofs +%to include (then, \texttt{\textbackslash{}printProofs} only input that +%file). You can input that file from other files if you want to separate +%the body from the proof, but it won't work if you have restate theorems. +%You should use the option \texttt{external\ appendix} (starting from +%version 2022/02/04) to restate appropriately the theorem: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv,conf=\{external appendix\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} +%\end{Highlighting} +%\end{Shaded} +% +%Then, compile your main file and create a new file for the appendix, +%load the theorems environments as for the main file, in the preambule +%load the \texttt{xr} package to properly have references (otherwise you +%won't have the appropriate number for the theorems) using something +%like: +% +%\begin{verbatim} +%\usepackage{xr} +%\externaldocument{name_of_main_file_without_extension} +%\end{verbatim} +% +%and in this new document just add the appendix wherever you want: +% +%\begin{Shaded} +%\begin{Highlighting}[] +%\FunctionTok{\textbackslash{}includeExternalAppendix}\NormalTok{\{name\_of\_main\_file\_without\_extension\}} +%\end{Highlighting} +%\end{Shaded} +% +%You can see an exemple in the github repository, with the two files +%\texttt{demo\_external\_appendix.tex} and +%\texttt{demo\_external\_appendix\_part2.tex}. Whenever your proofs +%change in the main paper, make sure to compile first the main document +%(so that the auxiliary file gets updated), and then compile the appendix +%document. Note that you can still use +%\texttt{\textbackslash{}printProofs} in the main document if you like +%(while writting your paper, it is certainly easier to keep the proofs +%and theorems in the same document). +% %\hypertarget{list-of-options}{% %\section{List of options}\label{list-of-options}} % @@ -911,6 +1007,9 @@ % \texttt{both}/\texttt{no\ both}: only for % \texttt{\textbackslash{}textInAppendix}, specifies that the text must % be present in both the main text and the appendix. +%\item +% \texttt{external\ appendix}: to ensure the appendix can be included in +% another file (see details above), starting from version 2022/02/04. %\end{itemize} % %Here are all the alias/styles (you can create you own as well), they are @@ -986,6 +1085,20 @@ % but takes one argument and use it instead of \texttt{Proof\ of}. % Example: \texttt{text\ proof\ translated=\{Preuve\ du\}} %\item +% \texttt{text\ link\ external\ appendix}: style used to configure the +% text to display when the appendix is in an external file. Defaults to +% \texttt{text\ link=\{The\ proof\ is\ in\ the\ appendix.\}}. +%\item +% \texttt{external\ appendix}: useful when the the proofs are moved in +% an external file (read more above). In particular, it will ensure that +% normal theorems are used instead of restate since restate does not +% work across files. This will also apply +% \texttt{text\ link\ external\ appendix} to change the text +% accordingly. +%\item +% \texttt{only\ external\ appendix}: like \texttt{external\ appendix}, +% but without changing the text. +%\item % \texttt{bare\ defaults}: default style that is loaded before anything % else that configure by default a link to the proof, put the proof in % appendix, use the category \texttt{defaultcategory}. It is an alias of @@ -1126,6 +1239,41 @@ %\begin{itemize} %\tightlist %\item +% 2022/02/07: +% +% \begin{enumerate} +% \def\labelenumi{\arabic{enumi}.} +% \tightlist +% \item +% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue +% 2} was not really solved in fact\ldots{} Now, I use a more robust +% method to detect the current section: I write in an AUX file the +% label of the proof section. This way, I don't need anymore to use +% dirty tricks to recover the section label. +% \item +% Change the default text when the appendix is in an external file, +% and add options like \texttt{text\ link\ external\ appendix} to +% customize the text appearing when the appendix is in an external +% file. Of course, you can still change it using \texttt{text\ link} +% directly. +% \end{enumerate} +%\item +% 2022/02/04: +% +% \begin{enumerate} +% \def\labelenumi{\arabic{enumi}.} +% \tightlist +% \item +% Add a way to put theorems in different files. (see +% \texttt{external\ appendix}) +% \item +% Change the path for auxiliary files (should be transparent for the +% user) +% \item +% Add commands to change local/global configuration easily (see +% \texttt{\textbackslash{}pratendSetLocal},\texttt{\textbackslash{}pratendSetGlobal}) +% \end{enumerate} +%\item % 2022/02/01: % % \begin{enumerate} @@ -1208,7 +1356,7 @@ % \end{macrocode} %\fi \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{proof-at-the-end}[2022/02/01 A package to move proofs in appendix] +\ProvidesPackage{proof-at-the-end}[2022/02/07 A package to move proofs in appendix] \RequirePackage{etoolbox} \RequirePackage{thmtools} @@ -1281,10 +1429,16 @@ \endgroup } +%% Get the prefix of the file, given the jobname. +\NewDocumentCommand\pratendGeneratePrefixFile{m}{#1-pratend} + +\def\prefixPrAtEndFiles{\pratendGeneratePrefixFile{\jobname}} + + %% This functions takes one input: the category (without .tex), %% If it's the first time we write in this %% category file, it "blanks" it. -\def\prefixPrAtEndFiles{pratend} + \newcommand*\eraseIfNeeded[1]{% % A macro 'pratendmacrocat{category}' is created to check % if it's the first time we write in this category file. @@ -1301,6 +1455,7 @@ \newif\ifproofhere \newif\ifproofend \newif\ifrestatethm +\newif\ifexternalAppendix% True if the output file should me inputable in another file (using xr for crossref). Useful to remote restate. \newif\iflinktoproof \newif\ifboth \newif\ifallattheend @@ -1319,6 +1474,15 @@ proof end/.is if=proofend, no proof end/.style={proof end=false}, %% Restate the theorem when using \printProofs + only external appendix/.is if=externalAppendix, + text link external appendix/.style={ + text link={The proof is in the appendix.} + }, + external appendix/.style={ + only external appendix, + text link external appendix, + }, + %% Restate the theorem when using \printProofs restate/.is if=restatethm, no restate/.style={restate=false}, %% Put a link to the proof after the theorem @@ -1500,9 +1664,13 @@ %% Restate the theorem if needed in appendix. %% As explained in https://github.com/leo-colisson/proof-at-the-end/issues/8 %% No need to restate of there is no proof at the end. - \ifproofend % - \ifrestatethm % - \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}% + \ifproofend% + \ifrestatethm% + \ifexternalAppendix% We write the full theorem, useful to compile in a separate file (use xr for references) + \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begingroup\string\renewcommand\string\the\detokenize{#2}{\string\ref{thm:prAtEnd\pratendcountercurrent}}\string\begin{\detokenize{#2}}[#3]\detokenize{#4}\string\end{\detokenize{#2}}\string\endgroup}% + \else% + \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}% + \fi% \fi% \fi% \fi% @@ -1540,13 +1708,41 @@ \fi% %% Write the proof at the end \ifproofend% + \appendtofile{\prefixPrAtEndFiles\category.tex}{% %% The label alone adds some space, see e.g. %% https://tex.stackexchange.com/questions/600118/selectlanguage-in-the-middle-of-text-causes-extra-vertical-space/600142#600142 %% and https://tex.stackexchange.com/questions/600577/adding-a-label-between-two-proofs-adds-unwanted-space %% The solution is to use \\Hy@SaveLastskip and \Hy@RestoreLastskip from hyperref %% See also %% https://tex.stackexchange.com/questions/553394/reliably-add-a-label-to-the-current-section-even-if-the-label-is-not-placed-rig/600847#600847 - \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\makeatletter\string\Hy@SaveLastskip\string\pratendChangeCurrentLabel\string\label{proofsection:prAtEnd\pratendcountercurrent}\string\Hy@RestoreLastskip\string\makeatother\string\begin{proof}[\pratendtextproof]\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}\detokenize{#2}\string\end{proof}}% + \string\makeatletter\string\Hy@SaveLastskip% + %% This tries to recover the label of the current section... But it is very bad. I keep it only for backward compatibility. I tried to fix it by changing the value of \@counter, but it's not always working + %% as cref is not using it apparently, and it turns Appendix A into appendix a after using phantomsection. + %% https://github.com/leo-colisson/proof-at-the-end/issues/2 + \string\label{proofsection:prAtEnd\pratendcountercurrent}% WARNING <-- do not use this label in new documents! + % the problem is that setting the \@currentlabel does not work for cref, and turns Appendix A + % into section A when a phantomsection lies in between (not sure why): + % https://github.com/leo-colisson/proof-at-the-end/issues/2 + %% Now, we prefer a different method: instead we generate a single label per section, and we generate + %% a new macro in the aux file that will save this label, by creating one such macro per theorem. + %% This is basically doing something like \pratend@section@for@proofiii{prAtEnd:sectionlike3} + %% Note that I need sometimes 3 \string because I write two times: the first time I write in the FILE-pratendCATEGORY.tex + %% file, and this file will be in charge of writting into the .aux file. + \string\ifdefined\string\pratend@current@sectionlike@label% But before, we check if the section was defined, or the code may fail if no section are defined. + \string\immediate\string\write\string\@auxout{% + \string\string\string\gdef\string\string\string\pratend@section@for@proof\pratendcountercurrent{\string\pratend@current@sectionlike@label}% + }% + \string\fi + % See above + \string\Hy@RestoreLastskip\string\makeatother% + % We start the proof + \string\begin{proof}[\pratendtextproof]% + % We add a label to have a reference to the section + \string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}% + % We add the proof + \detokenize{#2}% + % We end the proof + \string\end{proof}}% \fi% }{} @@ -1594,7 +1790,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We patch the \section, \subsection and \chapter commands to make sure that % the text "See proof in Section XX" points to the appropriate section/subsection. -% We basically maintain a counter counting how many time we saw a section/subsection/... and use it to label +% We basically maintain a counter counting how many times we saw a section/subsection/... and use it to label % directly the section afterwards. \newcounter{pratend@counter@sectionlike} %% Command to add after a label like "prAtEnd:sectionlike10". Useful to patch \section, \chapter... @@ -1602,17 +1798,21 @@ %% First, we get the label %% Cool explaination of expandafter, edef, noexpand: %%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf + %% The label \pratend@current@sectionlike@label is used later. \edef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% \expandafter\label{\pratend@current@sectionlike@label}% - \let\pratend@sectionlike@stored@label\@currentlabel% + \stepcounter{pratend@counter@sectionlike}% }% -\NewDocumentCommand\pratendSectionlikeCref{}{% - \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% -} -\NewDocumentCommand\pratendChangeCurrentLabel{}{% - \ifdefined\pratend@sectionlike@stored@label% - \let\@currentlabel\pratend@sectionlike@stored@label% +%% Returns the label of the section (in appendix) that contains the proof of the current theorem. +%% The first time, it will return an empty label. +\NewDocumentCommand\pratendLabelProofSection{}{% + \ifcsname pratend@section@for@proof\pratendcountercurrent\endcsname% + \csname pratend@section@for@proof\pratendcountercurrent\endcsname% \fi% +}% +\NewDocumentCommand\pratendSectionlikeCref{}{% + % \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% This is not robust enough. Lets change strategy. + \expandafter\pratendRef{\pratendLabelProofSection} } \ifpratendOptdisablePatchSection% \else % @@ -1641,6 +1841,7 @@ \csname \pratendOptcommandRef\endcsname{#1}% } + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Create automatically wrapper %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1695,8 +1896,37 @@ \newEndThm{theoremE}{theorem} \newEndThm{corollaryE}{corollary} \newEndThm{propositionE}{proposition} + \newEndThm{propertyE}{proposition} + \newEndThm{factE}{proposition} \fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Create functions to easily overwrite defaults +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\NewDocumentCommand\pratendSetGlobal{m}{% + \pgfkeys{/prAtEnd/global custom defaults/.style={ + #1 + }% + }% +} + +\NewDocumentCommand\pratendSetLocal{m}{% + \pgfkeys{/prAtEnd/local custom defaults/.style={ + #1 + }% + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Create functions to load the category file in another file (external bibliography) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Takes an optional category, and the job name of the external file. +\NewDocumentCommand\includeExternalAppendix{O{defaultcategory}m}{% + \expandafter\input{\pratendGeneratePrefixFile{#2}#1} +} + \endinput %\iffalse % \begin{macrocode} 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 3ebaf4fd466..d3508956ecc 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 2022/2/1 17:07 +% proof-at-the-end.ins generated using makedtx version 1.2 2022/2/7 18:01 \input docstrip \preamble |