%\iffalse % proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: % -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/" % -author "Léo Colisson" % -doc "../doc/proof-at-the-end_doc.tex" % -src "proof-at-the-end\.sty=>proof-at-the-end.sty" % proof-at-the-end % Created on 2024/1/26 15:25 %\fi %\iffalse %<*package> %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % %\fi % \iffalse % Doc-Source file to use with LaTeX2e % Copyright (C) 2024 Léo Colisson, all rights reserved. % \fi % \iffalse %<*driver> % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ ]{article} \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex} \ifPDFTeX \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available \usepackage[]{microtype} \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{} \makeatletter \@ifundefined{KOMAClassName}{% if non-KOMA class \IfFileExists{parskip.sty}{% \usepackage{parskip} }{% else \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}} }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother \usepackage{xcolor} \usepackage{color} \usepackage{fancyvrb} \newcommand{\VerbBar}{|} \newcommand{\VERB}{\Verb[commandchars=\\\{\}]} \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} % Add ',fontsize=\small' for more characters per line \newenvironment{Shaded}{}{} \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}} \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} \newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}} \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}} \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}} \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}} \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}} \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} \newcommand{\ExtensionTok}[1]{#1} \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}} \newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}} \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} \newcommand{\NormalTok}[1]{#1} \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}} \newcommand{\RegionMarkerTok}[1]{#1} \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}} \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}} \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} \usepackage{graphicx} \makeatletter \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} \makeatother % Scale images if necessary, so that they will not overflow the page % margins by default, and it is still possible to overwrite the defaults % using explicit options in \includegraphics[width, height, ...]{} \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} % Set default figure placement to htbp \makeatletter \def\fps@figure{htbp} \makeatother \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{5} \ifLuaTeX \usepackage{selnolig} % disable illegal ligatures \fi \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \urlstyle{same} % disable monospaced font for URLs \hypersetup{ pdftitle={Proof-at-the-end, or how to move proofs in appendix in LaTeX}, pdfauthor={Léo Colisson}, hidelinks, pdfcreator={LaTeX via pandoc}} \title{Proof-at-the-end, or how to move proofs in appendix in LaTeX} \author{Léo Colisson} \date{} \begin{document} \DocInput{proof-at-the-end.dtx} \end{document} % %\fi %\maketitle % %{ %\setcounter{tocdepth}{3} %\tableofcontents %} %WARNING: this package is definitely usable, but may not be as tested and %stable as standard packages. Note also that it may change a bit in the %future, but we will of course try to avoid as much as possible backward %incompatibilities. To ensure your document won't change when the package %get updates, it is always safer to copy the %\texttt{proof-at-the-end.sty} file at the root of your project. % %\hypertarget{introduction}{% %\section{Introduction}\label{introduction}} % %This package aims to provide a way to easily move proofs in the %appendix. You can: % %\begin{itemize} %\tightlist %\item % 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 (and % configure the text) %\item % Restate the theorem in appendix (or before) %\item % 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 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 % Include sketch of proof in the main text, and full proof in appendix %\item % Change the text of the link, for example to translate into another % language %\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 %\url{https://github.com/leo-colisson/proof-at-the-end} . Feel free to %contribute, report bugs, or read/copy-paste the documentation/examples %from there. % %Disclaimer: This package is still in beta and not considered as stable. % %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}} % %If you just want to see an example of what you can do, you can directly %open the file \texttt{demo.pdf} (also available online at %\url{https://github.com/leo-colisson/proof-at-the-end/raw/master/demo.pdf}) %to see what is possible, or generate it with % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{git}\NormalTok{ clone https://github.com/leo{-}colisson/proof{-}at{-}the{-}end.git} %\ExtensionTok{pdflatex}\NormalTok{ demo.tex }\KeywordTok{\&\&} \ExtensionTok{pdflatex}\NormalTok{ demo.tex} %\end{Highlighting} %\end{Shaded} % %\hypertarget{quickstart}{% %\section{Quickstart}\label{quickstart}} % %\hypertarget{super-quick-quickstart}{% %\subsection{Super Quick QuickStart}\label{super-quick-quickstart}} % %If \texttt{proof-at-the-end} it's not installed in your CTAN %distribution, copy the %\href{https://github.com/leo-colisson/proof-at-the-end/}{\texttt{proof-at-the-end.sty} %file} in your project. Then, in your project, create new theorem/lemma %environments (using any tool you like, like asmthm, ntheorem and %thmtools), load the library using %\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}} %(note that you need the version 2022/01/28 to have %\texttt{createShortEnv} defined, otherwise you need to use directly %\texttt{theoremEnd}) and write your theorem using: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} %\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ And I am a proof.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %The options (here \texttt{restate} and \texttt{end}) tells what should %go in appendix, how to configure the links\ldots{} Here the proof should %go in appendix, and the \texttt{restate} options states that the theorem %should be restated before the proof. Note that in case you don't want %any title but do want to add options, make sure to insert an empty pair %of brackets like in %\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}end,\ text\ link={]}} (the %option \texttt{text\ link} is used to choose the text of the link to the %proof, writting \texttt{text\ link=} is used to display no link at all). % %You can find below a full example to compile which should produce this %output (sorry, this is a screenshot, that way I can export it easily in %the github page). Just make sure to compile twice to get references. % %\begin{figure} %\centering %\includegraphics{screenshot.png} %\caption{Screenshot of the quickstart} %\end{figure} % %You can directly copy them (with a more complete demo) in the github %page here https://github.com/leo-colisson/proof-at-the-end/. % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{\textbackslash{}documentclass}\NormalTok{\{}\ExtensionTok{article}\NormalTok{\}} % %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{xparse}\NormalTok{\} }\CommentTok{\% Not needed with recent LaTeX} %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amsthm}\NormalTok{\}} % %\CommentTok{\% Create new theorems, or use ntheorem/thmtools/...} %\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]} %\CommentTok{\% Default uses autoref, but you can also use cleveref, see the documentation.} %\CommentTok{\% Say to autoref that "thm" are Theorems.} %\FunctionTok{\textbackslash{}newcommand}\NormalTok{\{}\ExtensionTok{\textbackslash{}thmautorefname}\NormalTok{\}\{Theorem\}} % %\CommentTok{\%\% Load the library. createShortEnv automatically creates the shortcuts} %\CommentTok{\%\% thmE, theoremE, lemmaE, propositionE, corollaryE, proofE. See \textbackslash{}newEndThm for more details.} %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} % %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}} % %\KeywordTok{\textbackslash{}section}\NormalTok{\{Theorems\}} % %\CommentTok{\%\% If you don\textquotesingle{}t have any title, leave an empty bracket like \textbackslash{}begin\{thmE\}[][end]} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} %\NormalTok{ I am a theorem} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ And I am a proof.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} % %\KeywordTok{\textbackslash{}section}\NormalTok{\{Proofs\}} %\FunctionTok{\textbackslash{}printProofs} % %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{install}{% %\subsection{Install}\label{install}} % %If your CTAN distribution is recent enough, you have nothing to do (if %you are using overleaf, note that you can configure your project to use %a more recent TexLive distribution: this packages is included starting %from TexLive 2019). Otherwise if it's not yet in your CTAN distribution, %first download the \texttt{proof-at-the-end.sty} file and insert it in %the root of your project with the following commands on unix (you can %also clone this repository if you prefer, or just manually download or %copy/paste the files on Windows). % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} %\VariableTok{repopratend}\OperatorTok{=}\StringTok{"https://raw.githubusercontent.com/leo{-}colisson/proof{-}at{-}the{-}end"} %\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/proof{-}at{-}the{-}end.sty} %\end{Highlighting} %\end{Shaded} % %It also requires a recent version of xparse (not present in TexLive 2018 %and before basically), otherwise you will get an error like: % %\begin{verbatim} %Unknown argument type 'b' replaced by 'm' %\end{verbatim} % %While %\href{https://raw.githubusercontent.com/leo-colisson/proof-at-the-end/c2150f4feba4709d47e43c00e5f8eb93ce345cab/xparse.sty}{we %used to provide} for simplicity a \texttt{xparse.sty} file (version %\texttt{2018-04-12}) in older versions of this repository, we removed it %to %\href{https://github.com/leo-colisson/proof-at-the-end/issues/6}{avoid %license issues and conflicts with recent LaTeX distributions that %already include xparse}. Nevertheless, if you are using an older %distribution, you can also download \texttt{xparse} manually %\href{http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}{here}, %unzip it, and copy the \texttt{.sty} files contained in %\texttt{tex/latex/l3packages/xparse/} at the root of your project. On %linux, you can do that via: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} %\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip} %\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3packages.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3packages/xparse/*\textquotesingle{}} %\FunctionTok{rm} \AttributeTok{{-}f}\NormalTok{ l3packages.tds.zip xparse.ltx} %\end{Highlighting} %\end{Shaded} % %If you have an old distribution of LaTeX (2017 or before basically), 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} or you will get an error like: % %\begin{verbatim} %Package xparse Error: Support package l3kernel too old. %\end{verbatim} % %To install it, download the zip files %\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip} %and %\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip} %(\texttt{l3backend} is %\href{https://tex.stackexchange.com/questions/499082/file-l3backend-pdfmode-def-not-found-when-loading-expl3}{since %July 1st, 2019} a dependency of l3kernel), unzip, and copy the content %of the directories \texttt{tex/latex/l3kernel/} (first archive) and %\texttt{tex/latex/l3backend/} (second archive) into your project. On %linux it's a matter of two commands in your project: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} %\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip} %\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3kernel.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3kernel/*\textquotesingle{}} %\FunctionTok{rm}\NormalTok{ l3kernel.tds.zip} %\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip} %\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3backend.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3backend/*\textquotesingle{}} %\FunctionTok{rm}\NormalTok{ l3backend.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}. % %If you still have errors, it's likely that your LaTeX distribution is %just too old (LaTeX 2016 seems to be too old to install a recent l3exp). %So just upgrade to a decent version, and you should not have any %troubles anymore. % %You can test your install by compiling the \texttt{demo.tex} file %present in the repository. When it compiles, you are ready to start! % %\hypertarget{use-in-your-project}{% %\subsection{Use in your project}\label{use-in-your-project}} % %Now, you can load the library in your project by simply using: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %Then, you can configure your theorem/lemma/\ldots{} environments as %usual, by using any counter you like\ldots: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amssymb, amsthm, amsmath}\NormalTok{\}} %\CommentTok{\% Theorems} %\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]} %\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{thm*\}\{Theorem\}} %\FunctionTok{\textbackslash{}providecommand*\textbackslash{}thmautorefname}\NormalTok{\{Theorem\}} %\CommentTok{\% Lemmata} %\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{lemma\}[thm]\{Lemma\}} %\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{lemma*\}\{Lemma\}} %\FunctionTok{\textbackslash{}providecommand*\textbackslash{}lemmaautorefname}\NormalTok{\{Lemma\}} %\end{Highlighting} %\end{Shaded} % %And inside your document, you can use the following syntax to create a %new theorem: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[OPTIONS]\{THEOREM ENVIRONMENT\}[OPTIONAL TITLE]} %\NormalTok{ YOUR THEOREM, with eventually labels like }\KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:OPTIONAL LABEL}\NormalTok{\}} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\} }\CommentTok{\%\% Optional environment} %\NormalTok{ YOUR (OPTIONAL) PROOF} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %For example: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}\{thm\}[Yes I can have a title]} % \KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:ilikelabels}\NormalTok{\}} %\NormalTok{ Creating a new theorem is easy} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ You want a proof? Here is it!} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %Since \texttt{theoremEnd} may be a bit verbose to use, we provide since %the version 2022/01/28, an option: if you load the program using %\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}}, %you will automatically have 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}, \texttt{propositionE} and \texttt{corollaryE}. Note %that it is your role to define the initial commands \texttt{thm}\ldots, %but you don't need to define them all, only those that you use. Then, %you can use them like: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} %\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ And I am a proof.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %Finally, to display the proofs, just use %\texttt{\textbackslash{}printProofs} where you like: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}printProofs} %\end{Highlighting} %\end{Shaded} % %If you would like to display a lemma instead, just change %\texttt{\{thm\}} into \texttt{\{lemma\}}, or into any other theorem %environment you defined! You can now compile safely your document ;) % %NB: if you want to make sure all the references are linked correctly, %make sure to compile twice the document! % %Isn't it simple ? % %\hypertarget{a-note-on-hyperref}{% %\subsection{\texorpdfstring{A note on %\texttt{hyperref}}{A note on hyperref}}\label{a-note-on-hyperref}} % %An older version of the package explicitely loaded \texttt{hyperref} %with no option, and an option clash could occur if the user wanted to %add options to \texttt{hyperref}. We now push the loading to the very %end to avoid that issue, but if you want to load packages \emph{after} %\texttt{hyperref} (like \texttt{cleveref}), it is your job to include %\texttt{hyperref}, for example by putting at the end of the preambule %something like: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[colorlinks]\{}\ExtensionTok{hyperref}\NormalTok{\}} %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{cleveref}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{use-cases}{% %\section{Use cases}\label{use-cases}} % %\hypertarget{configuration-and-how-to-use-and-create-styles}{% %\subsection{Configuration and how to use and create %styles}\label{configuration-and-how-to-use-and-create-styles}} % %You can very easily configure this package, and choose how each %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. % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[normal]\{thm\}[A title]} %\NormalTok{ You can easily turn a theorem back into a normal theorem!} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ And keep the proof with you!} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\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 %configuration set by left-most values): % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[proof at the end,} %\NormalTok{ no link to proof,} %\NormalTok{ text proof=\{Difficult proof\}} %\NormalTok{ ]\{thm\}[A title]} %\NormalTok{ Each theorem can have a custom configuration!} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ Quite practical, isn\textquotesingle{}t it?} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %You can easily create your own styles like that: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/my great style/.style=\{} %\NormalTok{ proot at the end,} %\NormalTok{ no link to proof,} %\NormalTok{ text proof=\{Difficult proof\},} %\NormalTok{ \}} %\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %You can also change the default configuration when you load the package %by nesting the configuration into a \texttt{conf} key: % %\begin{Shaded} %\begin{Highlighting}[] %\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[conf=\{normal, one big link\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %Note however that for now it is \emph{not} possible to use macros %directly inside the options when you load the package, so if you need to %use more complicated configuration, you can overwrite the %\texttt{global\ custom\ defaults} style for global configuration, and %the \texttt{local\ custom\ defaults} style for local configuration %(useful for example if you want to define a category for a single %section): % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/global custom defaults/.style=\{} %\NormalTok{ one big link=\{Go to proof on page\textasciitilde{}}\FunctionTok{\textbackslash{}pageref*}\NormalTok{\{proof:prAtEnd}\FunctionTok{\textbackslash{}pratendcountercurrent}\NormalTok{\}\}} %\NormalTok{ \}} %\NormalTok{\}} %\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} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/local custom defaults/.style=\{} %\NormalTok{ category=greattheorem} %\NormalTok{ \}} %\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %for short (needs version \textgreater{} 2022/02/04): % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}pratendSetLocal}\NormalTok{\{category=greattheorem\}} %\end{Highlighting} %\end{Shaded} % %Then you can use like that: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title]} %\NormalTok{ Here is a normal theorem with the proof in the main text.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ The (optional) proof} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} % %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][end]} %\NormalTok{ Here is a theorem whose proof goes to the end.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ The proof} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} % %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][all end]} %\NormalTok{ Here is a theorem that goes with the proof at the end.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\NormalTok{ The proof} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %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}} % %We predefined some pretty common styles/options. The full list is at the %end of this document, but here is a list of the most practical ones: % %\begin{itemize} %\tightlist %\item % \texttt{normal}: turn the theorem into a ``normal'' theorem, with the % proof in the main text and nothing in appendix %\item % \texttt{category=yourowncategory}: change the category of the theorem % (see next sub-section) %\item % \texttt{end}: put the proof in appendix %\item % \texttt{all\ end}: put both the theorem and the proof in appendix %\item % \texttt{debug}: make sure the proof is written in the main text as % well. Practical when you write the proof to be able to use synctex (if % 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 % 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) %\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.''. 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.'' %\item % \texttt{text\ proof\ translated=Your\ translation}: to % change/translate the text of the proof at the end easily %\item % \texttt{global\ custom\ defaults}: empty style that you can modify to % change the configuration (globally) %\item % \texttt{local\ custom\ defaults}: empty style that you can modify to % change the configuration (locally). Practical to set a category for a % single section. %\end{itemize} % %\hypertarget{categories-or-how-to-move-proofs-in-different-sections}{% %\subsection{Categories, or how to move proofs in different %sections}\label{categories-or-how-to-move-proofs-in-different-sections}} % %Let's imagine that you have some proofs that are easy to do, and some %proofs that are long but interesting. You may want to put the easy %proofs in a different place that the long proofs. It is super easy to %do, you just need to give a category name to the option %\texttt{category} like here: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[category=mylongproofs]\{thm\}[A title]} %\NormalTok{ You can easily change the place of the proofs} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ Just use a different category name!} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %and give this category name to \texttt{\textbackslash{}printProofs} in %the section where you would like to display the proofs: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}printProofs}\NormalTok{[mylongproofs]} %\end{Highlighting} %\end{Shaded} % %\hypertarget{comments}{% %\subsection{Comments}\label{comments}} % %You can also move some text in the appendix by using: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}textEnd}\NormalTok{\{Your text that should go in appendix\}} %\end{Highlighting} %\end{Shaded} % %You can also give it a category as explained above, or configure it to %be displayed in both the main text and at the end of the file with: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}textEnd}\NormalTok{[both]\{I am a comment that is written in both the main text} %\NormalTok{and the appendix\}} %\end{Highlighting} %\end{Shaded} % %You can also use the environment notation like that: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}[options]} %\NormalTok{ You can also use the environment syntax.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{restate-a-theorem}{% %\subsection{Restate a theorem}\label{restate-a-theorem}} % %It is easy to restate a theorem in the appendix, to have both the %theorem in the main text and in the appendix: just use the option %\texttt{restate}: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[end, restate]\{thm\}[A title]} %\NormalTok{ This theorem will be displayed both in main text and appendix.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ Just use restate option.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %You can also use the option \texttt{restate\ command=yourcustomcommand} %in order to create a macro \texttt{\textbackslash{}yourcustomcommand} %that will restate the theorem wherever you want (but after the %definition). % %If you want to (re)state a theorem \emph{before} its definition (say in %the introduction), there is also a special environment %\texttt{theoremEndRestateBefore} that requires a (unique) custom name %that you need to provide also later on in place of the real theorem with %the option \texttt{restated\ before}: % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}section}\NormalTok{\{Introduction\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}\{thm\}[Title]\{anamethatisusedtorestate\}} %\NormalTok{ It is possible to state the theorem before} %\NormalTok{ in the introduction, and restate it later} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}} % %\KeywordTok{\textbackslash{}section}\NormalTok{\{Real definition\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[restated before]\{thm\}} %\NormalTok{ anamethatisusedtorestate} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ Proof of the theorem, put in place of the theorem the unique name} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{translate-the-links}{% %\subsection{Translate the links}\label{translate-the-links}} % %The more powerful way to change the text of the links is to redefine %\texttt{text\ link} and \texttt{text\ proof} (see section List of %options for more details). However we defined also some easy way to %redefine the text using \texttt{one\ big\ link\ translated} and %\texttt{text\ proof\ translated}. For example, to create your %\texttt{french} style you can do: % %\begin{Shaded} %\begin{Highlighting}[] %\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/french/.style=\{} %\NormalTok{ one big link translated=\{Voir preuve page\},} %\NormalTok{ text proof translated=\{Preuve du\}} %\NormalTok{ \}} %\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{write-a-sketch-of-proof-in-the-main-text}{% %\subsection{Write a sketch of proof in the main %text}\label{write-a-sketch-of-proof-in-the-main-text}} % %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.'': % %\begin{Shaded} %\begin{Highlighting}[] %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[see full proof]\{thm\}} %\NormalTok{ I can also write a sketch of proof, and put the full proof in appendix.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}} %\NormalTok{ Hint: look at the alias options.} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\NormalTok{ You just use \textasciigrave{}\textasciigrave{}see full proof\textquotesingle{}\textquotesingle{} as an option} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} %\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}} % %Here is the list of fundamental options supported. Most options have a %\texttt{no} version, with \texttt{no} written before. Note that you may %prefer to use directly the alias/styles (see next paragraph) as the %options listed here are quite fundamental and atomic. % %\begin{itemize} %\item % \texttt{category}: category of the proof (if you want to put proofs at % several places), can be anything %\item % \texttt{proof\ here}/\texttt{no\ proof\ here}: put (or not) the proof % in the main text %\item % \texttt{proof\ end}/\texttt{no\ proof\ end}: display the proof in % appendix %\item % \texttt{restate}/\texttt{no\ restate}: restate the theorem in appendix %\item % \texttt{link\ to\ proof}/\texttt{no\ link\ to\ proof}: Display a link % to the proof in the main text %\item % \texttt{opt\ all\ end}/\texttt{no\ opt\ all\ end}: put the theorem and % proof only in appendix. You may prefer the alias \texttt{all\ end}, % that also makes sure that the proof is indeed displayed in appendix. %\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\}.\}} %\item % \texttt{text\ proof}: text displayed in place of ``Proof'' in the % appendix. Defaults to % \texttt{\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}} %\item % \texttt{restate\ command}: name of a unique macro (without backslash) % that will be defined as an alias to restate the theorem wherever you % want %\item % \texttt{restated\ before}: if the theorems has been stated before % (with \texttt{\textbackslash{}theoremProofEndRestateBefore}), then we % just need to put the restate command in place of the theorem, and % enable this option %\item % \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 %practical to quickly define a behaviours, but are made of the basic %options listed above: % %\begin{itemize} %\tightlist %\item % \texttt{normal}: like a `normal' theorem, without any proof in the % appendix, and with a proof displayed in the main text. Shortcut for % \texttt{proof\ here,\ no\ all\ end,\ no\ proof\ end,\ no\ link\ to\ proof,\ no\ restate,\ no\ both}. %\item % \texttt{end}: theorems whose proof need to go in the appendix. Shorcut % for \texttt{proof\ at\ the\ end,\ link\ to\ proof}. %\item % \texttt{all\ end}: makes sure both the theorem and the proof are in % appendix. Alias of \texttt{end,\ opt\ all\ end}. %\item % \texttt{proof\ at\ the\ end}: theorems whose proof need to go in the % appendix contrary to \texttt{end} it does not make sure that there is % a link to the proof. Shorcut for % \texttt{no\ proof\ here,\ no\ all\ end,\ proof\ end,\ no\ both}. %\item % \texttt{debug}: make sure the proof is written in the main text as % well (alias of \texttt{proof\ here,\ no\ opt\ all\ end}), it is quite % practical to use when you write a proof to be able to use synctex % features to move between the pdf and the file. %\item % \texttt{no\ link\ to\ theorem}: Remove the link from the proof to the % theorem, alias of \texttt{text\ proof=\{\textbackslash{}proofname\}} %\item % \texttt{stared} (or \texttt{no\ number}): when you use the stared % version of a theorem you don't have any number, so cref fails to write % a nice link to the theorem. This option changes the text of ``Proof'', % by keeping the link but writting only \texttt{Proof}. Equivalent to % \texttt{text\ proof=\{\textbackslash{}string\textbackslash{}mbox\{\textbackslash{}string\textbackslash{}hyperref{[}thm:prAtEnd\textbackslash{}pratendcountercurrent{]}\{\textbackslash{}proofname\}\}\}} %\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\}.\}} %\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.\}}. %\item % \texttt{one\ big\ link\ translated}: This is like % \texttt{one\ big\ link}, but automatically add the page at the end % (and a big link around). Practical to quickly define a translation % 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{}pratendSectionlikeCref.\}} %\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{}pratendSectionlikeCref.\}} %\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\}.\}} %\item % \texttt{default\ text\ proof}: default text for the proof in appendix, % equivalent of % \texttt{text\ proof=\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}} %\item % \texttt{text\ proof\ translated}: like \texttt{default\ text\ proof}, % 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 % \texttt{end,\ link\ to\ proof,\ no\ restate,category=defaultcategory,\ default\ text\ link,default\ text\ proof,restate\ command=pratenddummymacro}. %\item % \texttt{configuration\ options}: style that contains the options used % to load the package. It is called right after \texttt{bare\ defaults}. % Note that you cannot insert macro in the options, overwrite % \texttt{global\ custom\ defaults} instead %\item % \texttt{global\ custom\ defaults}: empty style that you can overwrite % to change the global defaults %\item % \texttt{local\ custom\ defaults}: empty style that you can overwrite % to change the ``local'' defaults, like category %\item % \texttt{all\ defaults}: all the defaults, equivalent of % \texttt{bare\ defaults,\ configuration\ options,\ global\ custom\ defaults,\ local\ custom\ defaults} %\end{itemize} % %\hypertarget{package-options}{% %\section{Package options}\label{package-options}} % %The package comes with multiple options: - The %\texttt{conf=\{CONFIGURATION\}} option is used to configure the default %style. Usage: %\texttt{\textbackslash{}usepackage{[}conf=\{normal,\ text\ link\ section\}{]}\{proof-at-the-end\}} %- The \texttt{disablePatchSection} is useful to stop the library from %patching the section-like commands and chapters (by default, we %automatically add a \texttt{\textbackslash{}label} at the end of the %section which is used by \texttt{text\ link\ section} to find the %Appendix). If you enable this option, you can manually add the label by %using \texttt{\textbackslash{}pratendAddLabel} after the appendix %section (without any argument). - \texttt{commandRef=NAMECOMMAND}: By %default, theorem are referenced to using %\texttt{\textbackslash{}autoref\{\}}. You can change the value of %\texttt{NAMECOMMAND} to use another command, like %\texttt{commandRef=Cref} to use \texttt{\textbackslash{}Cref\{\}}. In %that case, make sure to load both \texttt{hyperref} and %\texttt{cleveref} (typically at the very end of your preambule) as %\texttt{cleveref} needs to be loaded after \texttt{hyperref}. %Internally, the library creates and uses %\texttt{\textbackslash{}pratendRef} instead of %\texttt{\textbackslash{}autoref}. - \texttt{createShortEnv}: creates %(using \texttt{newEndThm} and \texttt{newEndProof}) 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}. Note that it %is still your job to define the \texttt{thm}, \texttt{lemma} %environments. % %\hypertarget{troubleshooting}{% %\section{Troubleshooting}\label{troubleshooting}} % %Here are some common issues you may have, with explainations to solve %them. % %\hypertarget{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}{% %\subsection{The link after the proof does not mention the section, but %something else (an equation, a figure, %etc.)}\label{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.}} % %Sometimes, you may see something like %\texttt{See\ proof\ in\ Equation\ A} instead of %`\texttt{See\ proof\ in\ Appendix\ A}. This issue %\href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{was %reported before} and should be solved on newer versions (starting from %2022/01/27) by automatically patching sections. If you have this issue, %just upgrade (for instance by copying the %\href{https://github.com/leo-colisson/proof-at-the-end}{\texttt{proof-at-the-end.sty} %file} at the root of your project). We proceed by patching the %\texttt{\textbackslash{}chapter}, \texttt{\textbackslash{}section}, %\texttt{\textbackslash{}subsection}, \texttt{subsubsection} and %\texttt{\textbackslash{}paragraph} commands to add %\texttt{\textbackslash{}pratendAddLabel} which will help the package to %find the label of the current section. If you prefer the old behavior, %you can disable it using the \texttt{disablePatchSection} option (more %details in the package options). % %\hypertarget{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}{% %\subsection{\texorpdfstring{I get an error %\texttt{ERROR:\ File\ ended\ while\ scanning\ use\ of\ \textbackslash{}@xverbatim.} %when using verbatim inside a %theorem}{I get an error ERROR: File ended while scanning use of \textbackslash@xverbatim. when using verbatim inside a theorem}}\label{i-get-an-error-error-file-ended-while-scanning-use-of-xverbatim.-when-using-verbatim-inside-a-theorem}} % %I turns out that this library needs to use the \texttt{+b} option of %environments in order to manipulate appropriately the theorem/proof. %Unfortunately, it means that it is not possible to use verbatim %environments inside. While %\href{https://tex.stackexchange.com/questions/489435/use-environment-into-new-xparse-environment}{this %answer} suggests that it is impossible to avoid this issue, other people %reported that it may be possible to use catcodes to capture the %environment body verbatim, before using scantokens to reparse it, or to %use %\href{https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf}{filecontentsdef} %(see for instance %\href{https://tex.stackexchange.com/questions/631810/create-a-newdocumentenvironment-programmatically?noredirect=1\#comment1575605_631810}{this %comment}{]}, ). However, it may be possible that this make syntex %unusable, so it may not worth the effort. % %In anycase, there exists some workarounds, some of the are for instance %give in the \href{https://texfaq.org/FAQ-verbwithin}{TeX FAQ}. The %simplest solution, if your code is simple/short enough, is to use %\texttt{\textbackslash{}texttt} (you can replace backslash with %\texttt{\textbackslash{}textbackslash} inside etc, and include it in a %\texttt{verse} if you have multiple lines). If you have a longer text, %you may also like \texttt{lrbox} to put your content inside a box, for %instance like that: % %\begin{Shaded} %\begin{Highlighting}[] %\CommentTok{\%\% Create the box} %\FunctionTok{\textbackslash{}newsavebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} % %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} % \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}\{1.0}\FunctionTok{\textbackslash{}linewidth}\NormalTok{\}} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}} %\VerbatimStringTok{\textbackslash{}newEndThm[normal]\{thmE\}\{thm\}} %\VerbatimStringTok{\textbackslash{}newEndProof\{proofE\}\{proof\}} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}} % \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}} % %\CommentTok{\%\% Create a theorem:} %\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\NormalTok{ Insert the box:} % % \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}} % \FunctionTok{\textbackslash{}usebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} % \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}} %\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} %\end{Highlighting} %\end{Shaded} % %\hypertarget{changelog}{% %\section{Changelog}\label{changelog}} % %\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} % \def\labelenumi{\arabic{enumi}.} % \tightlist % \item % Fix a typo when defining the shortcut for lemma % \item % Add a shortcut for proposition % \item % Fix a small spacing issue in the text before the proof in Appendix % \end{enumerate} %\item % 2022/01/28: % % \begin{enumerate} % \def\labelenumi{\arabic{enumi}.} % \tightlist % \item % Fix the issue when using sharps in a proof % https://github.com/leo-colisson/proof-at-the-end/issues/7. % \item % Provide \texttt{\textbackslash{}newEndThm}, % \texttt{\textbackslash{}newEndProof} and the option % \texttt{createShortEnv} to quickly create environments. % \end{enumerate} %\item % 2022/01/27: % % \begin{enumerate} % \def\labelenumi{\arabic{enumi}.} % \tightlist % \item % Patch chapters/sections/\ldots{} to better detect the current % section and fix % \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue % 2}. This can be disabled using the package option % \texttt{disablePatchSection}. % \item % Add an option \texttt{commandRef} to use other ref libraries, like % \texttt{cleveref} instead of \texttt{autoref}. % \item % Normal restatable theorem do not need to be restated. Fix % \href{https://github.com/leo-colisson/proof-at-the-end/issues/8}{issue % 8}. % \end{enumerate} %\end{itemize} % %\hypertarget{contributions}{% %\section{Contributions}\label{contributions}} % %Feel free to contribute, report bugs, and send pull requests on the %github repository \url{https://github.com/leo-colisson/proof-at-the-end} %! % %NB: the documentation is generated from the Markdown file %\texttt{README.md} thanks to pandoc. These commands may help you: % %\begin{Shaded} %\begin{Highlighting}[] %\ExtensionTok{\%\%}\NormalTok{ Compile the demo} %\FunctionTok{make}\NormalTok{ demo} %\ExtensionTok{\%\%}\NormalTok{ Clean the project} %\FunctionTok{make}\NormalTok{ clean} %\ExtensionTok{\%\%}\NormalTok{ Generate the documentation} %\FunctionTok{make}\NormalTok{ doc} %\ExtensionTok{\%\%}\NormalTok{ Generate a package for CTAN} %\FunctionTok{make}\NormalTok{ package} %\end{Highlighting} %\end{Shaded} % % % % %\StopEventually{} %\section{The Code} %\iffalse % \begin{macrocode} %<*proof-at-the-end.sty> % \end{macrocode} %\fi \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{proof-at-the-end}[2024/01/26 A package to move proofs in appendix] \RequirePackage{etoolbox} \RequirePackage{thmtools} \RequirePackage{thm-restate} \RequirePackage{catchfile} \RequirePackage{pgfkeys} \RequirePackage{xparse} % Load hyperref at the end \AtEndPreamble{% \RequirePackage{hyperref} }% \RequirePackage{kvoptions} %% https://tex.stackexchange.com/questions/109747/put-all-package-options-into-one-command %% Forward the options list to the command \pratendOptdefconf %% in order to use: %% \usepackage[conf={normal}]{proof-at-the-end} \SetupKeyvalOptions{ family=pratendOpt, prefix=pratendOpt, % "Namespace": Prefix of the commands, conditions.... } \DeclareStringOption{conf} \DeclareLocalOptions{conf}% \pratendOptdefconf contains the proof \DeclareBoolOption{disablePatchSection} % Use \ifpratendOptdisablePatchSection ... \else ... \fi \DeclareStringOption[autoref]{commandRef} % Use commandRef=cref to use cleveref. Defaults to autoref. \DeclareBoolOption{createShortEnv} % To create thmE, theoremE, proofE, lemmaE, corrolaryE \ProcessKeyvalOptions* % \DeclareOption*{\PackageWarning{proof-at-the-end}{Unknown}} % \ProcessOptions\relax %% https://tex.stackexchange.com/a/13289/116348 \newwrite\appendwrite \newcount\pratend@count@makeallother %%% Loop to make sure all chars are normal letters, including #. \newcommand{\makeallother}{% \pratend@count@makeallother0\relax \loop\ifnum\pratend@count@makeallother<255\relax \catcode\pratend@count@makeallother12\relax \advance\pratend@count@makeallother by 1\relax \repeat } %%% This command allows the user to append things to a file. But the content may contain macros that %%% will be evaluated before writing them to the file. %%% TODO: Efficiency may be improved by writing to the file only before the printProof. % The first argument is the file name % The second argument is the text to write \NewDocumentCommand\appendtofile{m+m}{% \begingroup %% Read the content \begingroup% \IfFileExists{#1}{% \newlinechar\endlinechar% \makeallother% Turn all chars into normal letters. \everyeof{\noexpand}% \edef\fileContent{\@@input #1 }% }{% \let\fileContent\empty }% %% Open the file to write in it: \immediate\openout\appendwrite #1\relax% %% Write the text \immediate\write\appendwrite{\fileContent}% \endgroup% \immediate\write\appendwrite{#2}% %% Close the file \immediate\closeout\appendwrite% \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. \newcommand*\eraseIfNeeded[1]{% % A macro 'pratendmacrocat{category}' is created to check % if it's the first time we write in this category file. \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}% \immediate\openout\appendwrite=\prefixPrAtEndFiles#1.tex% \immediate\write\appendwrite{}% \immediate\closeout\appendwrite% }% } \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 \newif\ifrestatedbefore \pgfkeys{ /prAtEnd/.cd, %% Proof at end will be the main path %% Category of the proof (if you want to put proofs %% at several places), can be anything category/.initial=defaultcategory, category/.store in=\category, category/.get=\category, %% Display the proof in the main part proof here/.is if=proofhere, no proof here/.style={proof here=false}, % alias %% Display the proof when using \printProofs 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 link to proof/.is if=linktoproof, no link to proof/.style={link to proof=false}, %% Put the theorem and proof only in appendix opt all end/.is if=allattheend, no opt all end/.style={opt all end=false}, %% Text of link text link/.code={\def\pratendtextlink{#1}}, %% Text of proof. Make sure also to "\renewcommand*{\proofname}{Name of the proof}" %% to make sure the proof for normal theorems are changed text proof/.code={\def\pratendtextproof{#1}}, %% Custom restate command 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: restated before/.is if=restatedbefore, no restated before/.style={restated before=false}, %% In star version, we don't want %% Put the text (defined only for \textInAppendix) in both the %% current location and in appendix both/.is if=both, no both/.style={both=false}, %%%% Alias and styles normal/.style={ proof here, no opt all end, no proof end, no link to proof, no restate, no both, }, proof at the end/.style={ no proof here, no opt all end, proof end, no both, }, end/.style={ proof at the end, link to proof, }, all end/.style={ end, opt all end, }, debug/.style={ no opt all end, proof here }, no link to theorem/.style={ % Remove the link to the theorem text proof={\proofname}, }, stared/.style={ % Remove text proof={\string\mbox{\string\hyperref[thm:prAtEnd\pratendcountercurrent]{\proofname}}}, }, no number/.style={ stared }, see full proof/.style={ 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}. }, one big link translated/.style={ one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}.} }, text link section/.style={% text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \pratendSectionlikeCref.} }, text link section full proof/.style={% text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \pratendSectionlikeCref.} }, default text link/.style={ text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}, }, text proof translated/.style={ text proof={#1 \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, }, default text proof/.style={ text proof={Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, }, %%%% Defaults bare defaults/.style={ end, link to proof, no restate, category=defaultcategory, default text link, default text proof, restate command=pratenddummymacro, }, configuration options/.style/.expand once={ % This styles will contain the configuration % given as options of the package like: % \usepackage[conf={normal, no link to proof}]{proof-at-the-end} % The package options does not accept macros and valued keys % due to some fundamental issues: % https://tex.stackexchange.com/questions/489564/use-unexpanded-macro-in-package-options/489570#489570 % so if you need to write macro/valued key, edit instead the % style "/prAtEnd/global custom defaults" or % "local /prAtEnd/custom defaults" for local changes instead. \pratendOptconf% }, global custom defaults/.style={ %% you can put in this style any global defaults %% that should overwrite the usual defaults. }, local custom defaults/.style={ %% you can put in this style any overwrite of the defaults %% that should be "local" and changed over the file, like % the category for a given section. }, all defaults/.style={ %% Load all the style that sets the default values bare defaults, configuration options, global custom defaults, local custom defaults, }, } \newcounter{counterAllProofEnd} \stepcounter{counterAllProofEnd} \NewDocumentEnvironment{theoremEndRestateBefore}{mO{}m+b}{ \stepcounter{counterAllProofEnd}% \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{theoremEndOrig}{O{}mO{}+b}{ % The first facultative argument will be the options: type of proof you want, the file to which you want to write... % The first mandatory option is the type of the theorem (thm,lemma,...) % The second facultative argument will be the title % the second mandatory option is the theorem (will \label inside eventually) % the last mandatory option is the proof, or, if restated, the name of the theorem. \global\def\pratendlastoptions{#1}% \pgfkeys{% /prAtEnd/.cd, all defaults, #1 }% \stepcounter{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% \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 \unless\ifrestatedbefore% \temprest% \label{thm:prAtEnd\roman{counterAllProofEnd}}% #4% \end{restatable}% %% Store the current (alpha value of the) counter %% in \pratendcountercurrent \protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} % \fi% %% Create a custom alias to restate the theorem \expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}% %% 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% \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% %% If the theorem is not stated in the main text, %% write it at the end \ifallattheend% %% Store the current (alpha value of the) counter %% in \pratendcountercurrent \protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} %% Create a custom alias to restate the theorem \expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}% \appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[\detokenize{#3}]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}% \fi% }{} %% See proofEnableDebugSynctex %%% WARNING: if you change this function, change also proofDisableDebugSynctex \NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% \begin{theoremEndOrig}[#1]{#2}[#3] #4% \end{theoremEndOrig}% }{} \NewDocumentEnvironment{proofEndOrig}{O{}+b}{% \pgfkeys{% /prAtEnd/.cd, all defaults, prAtEndTmpStyle/.style/.expand once={\pratendlastoptions}, prAtEndTmpStyle, #1 }% \unless\ifallattheend% %% Write eventually a link to the proof \iflinktoproof% \pratendtextlink{}% \fi% %% And eventually the proof \ifproofhere% \begin{proof}% #2% \end{proof}% \fi% \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 \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% }{} %%% WARNING: if you change this function, change also proofDisableDebugSynctex \NewDocumentEnvironment{proofEnd}{O{}+b}{% \begin{proofEndOrig}[#1]% #2 \end{proofEndOrig}% }{} %%%%% For synctex debugging %% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 \NewDocumentCommand{\pratendEnableDebugSynctex}{}{% \RenewDocumentEnvironment{theoremEnd}{O{}mO{}}{\begin{##2}}{\end{##2}} \RenewDocumentEnvironment{proofEnd}{O{}}{\begin{proof}}{\end{proof}} } %% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 \NewDocumentCommand{\pratendDisableDebugSynctex}{}{% \RenewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% \begin{theoremEndOrig}[##1]{##2}[##3]% ##4% \end{theoremEndOrig}% }{}% \RenewDocumentEnvironment{proofEnd}{O{}+b}{% \begin{proofEndOrig}[##1]% ##2% \end{proofEndOrig}% }{} } \NewDocumentEnvironment{proofEndDebug}{O{}}{% \begin{proof}% }{% \end{proof}% } \NewDocumentEnvironment{theoremEndDebug}{O{}mO{}}{\begin{#2}}{\end{#2}} %%%%% Text in appendix \NewDocumentEnvironment{textAtEnd}{O{}+b}{ % Use it to put normal text in Appendix. \pgfkeys{ /prAtEnd/.cd, all defaults, #1 }% \ifboth% #2% \fi% \eraseIfNeeded{\category}% \appendtofile{\prefixPrAtEndFiles\category.tex}{\detokenize{#2}}% }{} \NewDocumentCommand\textEnd{O{}+m}{% \begin{textAtEnd}[#1]% #2% \end{textAtEnd}% } \NewDocumentCommand\printProofs{O{defaultcategory}}{ \input{\prefixPrAtEndFiles#1.tex} } %%% You can easily modify the defaults: % \pgfkeys{/prAtEnd/custom defaults/.style={ % category=greattheorem % } % } %%% Or create new styles to apply: % \pgfkeys{/prAtEnd/great category/.style={ % category=greattheorem % } % } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Patch sections, chapters... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 (option conf={text link section}). % 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... \NewDocumentCommand\pratendAddLabel{}{% %% 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. \xdef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% \expandafter\label{\pratend@current@sectionlike@label}% \stepcounter{pratend@counter@sectionlike}% }% %% 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 % %% Add the command \pratendAddLabel to \chapter/sections… if the command exists %% KOMA class need a special treatment \@ifundefined{KOMAClassName}{% % For articles/... \ifdef{\@chapter}{ \ifpatchable*{\@chapter}{ \apptocmd{\@chapter}{\pratendAddLabel}{}{}% }{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}} }{} %% patch sections/subsections/paragraph/... %% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717 \ifdef{\@sect}{ % \apptocmd{\section}{\pratendAddLabel}{}{}% \ifpatchable*{\@sect}{ \apptocmd{\@sect}{\pratendAddLabel}{}{}% }{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}} }{}% }{% %% For KOMA classes/... or it won't work with scrreport %% \AddtoDoHook{heading/endgroup/chapter} is too specific \AddtoDoHook{heading/endgroup/chapter}{\pratendAddLabel}% \AddtoDoHook{heading/endgroup/section}{\pratendAddLabel}% }% \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Allow cref/autoref/... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Instead of \autoref{proof:blabla} use \pratendRef{proof:blabla}, it allows the ref command to be customized %% as an option of the package. \NewDocumentCommand\pratendRef{m}{% \csname \pratendOptcommandRef\endcsname{#1}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Create automatically wrapper %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Defines a shortcut to avoid typing the whole theoremEnd environment. %% Avoid to manually type \NewDocumentEnvironment... %% Usage: \newEndThm[default options]{new environment}{old environment} % E.g.: \newEndThm[normal]{thmE}{thm}{} \NewDocumentCommand{\newEndThm}{O{}mm}{% % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% % \begin{theoremEnd}[#1,##2]{#3}[##1]% % ##3% % \end{theoremEnd}% % }{} \NewDocumentEnvironment{#2}{O{}O{}}{% \begin{theoremEnd}[#1,##2]{#3}[##1]% }{\end{theoremEnd}}% \NewDocumentEnvironment{#2D}{O{}O{}}{% \bgroup% \pratendEnableDebugSynctex{}% \begin{theoremEnd}[#1,##2]{#3}[##1]% }{\end{theoremEnd}% \egroup% }% } % \NewDocumentCommand{\newEndThm}{O{}mm}{% % % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% % % \begin{theoremEnd}[#1,##2]{#3}[##1]% % % ##3% % % \end{theoremEnd}% % % }{} % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% % \begin{theoremEnd}[#1,##2]{#3}[##1]% % ##3 % \end{theoremEnd}% % }{} % } %% Avoid to manually type \NewDocumentEnvironment... %% Usage: \newEndProof[default options]{new proof environment}{old proof environment} % E.g.: \newEndProof[]{proofE}{proof} \NewDocumentCommand{\newEndProof}{O{}m}{% \NewDocumentEnvironment{#2}{O{}+b}{% \begin{proofEnd}[#1,##1]% ##2% \end{proofEnd}% }{}% \NewDocumentEnvironment{#2D}{O{}}{% \begin{proofEndDebug}[##1]% }{% \end{proofEndDebug}% }% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Create even more automatically wrapper with option "createShortEnv" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifpratendOptcreateShortEnv %%% We create automatically the environments. \newEndProof{proofE} \newEndThm{thmE}{thm} \newEndThm{lemmaE}{lemma} \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} % % \end{macrocode} %\fi %\Finale \endinput