| 1 |
%\iffalse |
| 2 |
% proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot |
| 3 |
% Command line args: |
| 4 |
% -src "proof-at-the-end\.sty=>proof-at-the-end.sty" |
| 5 |
% -author "Léo Colisson" |
| 6 |
% -doc "../doc/proof-at-the-end_doc.tex" |
| 7 |
% -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/" |
| 8 |
% proof-at-the-end |
| 9 |
% Created on 2026/1/12 21:40 |
| 10 |
%\fi |
| 11 |
%\iffalse |
| 12 |
%<*package> |
| 13 |
%% \CharacterTable |
| 14 |
%% {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 |
| 15 |
%% 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 |
| 16 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 17 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 18 |
%% Dollar \$ Percent \% Ampersand \& |
| 19 |
%% Acute accent \' Left paren \( Right paren \) |
| 20 |
%% Asterisk \* Plus \+ Comma \, |
| 21 |
%% Minus \- Point \. Solidus \/ |
| 22 |
%% Colon \: Semicolon \; Less than \< |
| 23 |
%% Equals \= Greater than \> Question mark \? |
| 24 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 25 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 26 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 27 |
%% Right brace \} Tilde \~} |
| 28 |
%</package> |
| 29 |
%\fi |
| 30 |
% \iffalse |
| 31 |
% Doc-Source file to use with LaTeX2e |
| 32 |
% Copyright (C) 2026 Léo Colisson, all rights reserved. |
| 33 |
% \fi |
| 34 |
% \iffalse |
| 35 |
%<*driver> |
| 36 |
% Options for packages loaded elsewhere |
| 37 |
\PassOptionsToPackage{unicode}{hyperref} |
| 38 |
\PassOptionsToPackage{hyphens}{url} |
| 39 |
\documentclass[ |
| 40 |
]{article} |
| 41 |
\usepackage{xcolor} |
| 42 |
\usepackage{amsmath,amssymb} |
| 43 |
\setcounter{secnumdepth}{5} |
| 44 |
\usepackage{iftex} |
| 45 |
\ifPDFTeX |
| 46 |
\usepackage[T1]{fontenc} |
| 47 |
\usepackage[utf8]{inputenc} |
| 48 |
\usepackage{textcomp} % provide euro and other symbols |
| 49 |
\else % if luatex or xetex |
| 50 |
\usepackage{unicode-math} % this also loads fontspec |
| 51 |
\defaultfontfeatures{Scale=MatchLowercase} |
| 52 |
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} |
| 53 |
\fi |
| 54 |
\usepackage{lmodern} |
| 55 |
\ifPDFTeX\else |
| 56 |
% xetex/luatex font selection |
| 57 |
\fi |
| 58 |
% Use upquote if available, for straight quotes in verbatim environments |
| 59 |
\IfFileExists{upquote.sty}{\usepackage{upquote}}{} |
| 60 |
\IfFileExists{microtype.sty}{% use microtype if available |
| 61 |
\usepackage[]{microtype} |
| 62 |
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts |
| 63 |
}{} |
| 64 |
\makeatletter |
| 65 |
\@ifundefined{KOMAClassName}{% if non-KOMA class |
| 66 |
\IfFileExists{parskip.sty}{% |
| 67 |
\usepackage{parskip} |
| 68 |
}{% else |
| 69 |
\setlength{\parindent}{0pt} |
| 70 |
\setlength{\parskip}{6pt plus 2pt minus 1pt}} |
| 71 |
}{% if KOMA class |
| 72 |
\KOMAoptions{parskip=half}} |
| 73 |
\makeatother |
| 74 |
\usepackage{color} |
| 75 |
\usepackage{fancyvrb} |
| 76 |
\newcommand{\VerbBar}{|} |
| 77 |
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]} |
| 78 |
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} |
| 79 |
% Add ',fontsize=\small' for more characters per line |
| 80 |
\newenvironment{Shaded}{}{} |
| 81 |
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} |
| 82 |
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} |
| 83 |
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{#1}} |
| 84 |
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} |
| 85 |
\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{#1}} |
| 86 |
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
| 87 |
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{#1}}} |
| 88 |
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} |
| 89 |
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{#1}} |
| 90 |
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
| 91 |
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{#1}} |
| 92 |
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} |
| 93 |
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{#1}}} |
| 94 |
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{#1}}} |
| 95 |
\newcommand{\ExtensionTok}[1]{#1} |
| 96 |
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{#1}} |
| 97 |
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{#1}} |
| 98 |
\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.50,0.00}{\textbf{#1}}} |
| 99 |
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} |
| 100 |
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{#1}}} |
| 101 |
\newcommand{\NormalTok}[1]{#1} |
| 102 |
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}} |
| 103 |
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{#1}} |
| 104 |
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{#1}} |
| 105 |
\newcommand{\RegionMarkerTok}[1]{#1} |
| 106 |
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
| 107 |
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{#1}} |
| 108 |
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
| 109 |
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{#1}} |
| 110 |
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}} |
| 111 |
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}} |
| 112 |
\usepackage{graphicx} |
| 113 |
\makeatletter |
| 114 |
\newsavebox\pandoc@box |
| 115 |
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width |
| 116 |
\sbox\pandoc@box{#1}% |
| 117 |
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}% |
| 118 |
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}% |
| 119 |
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both |
| 120 |
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}% |
| 121 |
\else\usebox{\pandoc@box}% |
| 122 |
\fi% |
| 123 |
} |
| 124 |
% Set default figure placement to htbp |
| 125 |
\def\fps@figure{htbp} |
| 126 |
\makeatother |
| 127 |
\setlength{\emergencystretch}{3em} % prevent overfull lines |
| 128 |
\providecommand{\tightlist}{% |
| 129 |
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} |
| 130 |
\usepackage{bookmark} |
| 131 |
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available |
| 132 |
\urlstyle{same} |
| 133 |
\hypersetup{ |
| 134 |
pdftitle={Proof-at-the-end, or how to move proofs in appendix in LaTeX}, |
| 135 |
pdfauthor={Léo Colisson}, |
| 136 |
hidelinks, |
| 137 |
pdfcreator={LaTeX via pandoc}} |
| 138 |
|
| 139 |
\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX} |
| 140 |
\author{Léo Colisson} |
| 141 |
\date{} |
| 142 |
|
| 143 |
\begin{document} |
| 144 |
\DocInput{proof-at-the-end.dtx} |
| 145 |
\end{document} |
| 146 |
%</driver> |
| 147 |
%\fi |
| 148 |
%\maketitle |
| 149 |
% |
| 150 |
%{ |
| 151 |
%\setcounter{tocdepth}{3} |
| 152 |
%\tableofcontents |
| 153 |
%} |
| 154 |
%WARNING: this package is definitely usable, but may not be as tested and |
| 155 |
%stable as standard packages. Note also that it may change a bit in the |
| 156 |
%future, but we will of course try to avoid as much as possible backward |
| 157 |
%incompatibilities. To ensure your document won't change when the package |
| 158 |
%get updates, it is always safer to copy the |
| 159 |
%\texttt{proof-at-the-end.sty} file at the root of your project. |
| 160 |
% |
| 161 |
%\section{Introduction}\label{introduction} |
| 162 |
% |
| 163 |
%This package aims to provide a way to easily move proofs in the |
| 164 |
%appendix. You can: |
| 165 |
% |
| 166 |
%\begin{itemize} |
| 167 |
%\tightlist |
| 168 |
%\item |
| 169 |
% Move proofs in different places/sections by giving different |
| 170 |
% ``categories'' to the theorems |
| 171 |
%\item |
| 172 |
% Create links from theorem to proof, and from proof to theorem (and |
| 173 |
% configure the text) |
| 174 |
%\item |
| 175 |
% Restate the theorem in appendix (or before) |
| 176 |
%\item |
| 177 |
% Choose what you want to keep in the main text or in appendix (you can |
| 178 |
% put in appendix either everything, just the proof, the theorem and the |
| 179 |
% proof by keeping (or not) a copy in the body of the article\ldots) |
| 180 |
%\item |
| 181 |
% Duplicate the proof in appendix and in the current section, practical |
| 182 |
% to use synctex during the proof writting |
| 183 |
%\item |
| 184 |
% Add text that would appear only in the appendix (or in both body and |
| 185 |
% appendix) |
| 186 |
%\item |
| 187 |
% Easily change the defaults, and create your own styles/environments |
| 188 |
%\item |
| 189 |
% Include sketch of proof in the main text, and full proof in appendix |
| 190 |
%\item |
| 191 |
% Change the text of the link, for example to translate into another |
| 192 |
% language |
| 193 |
%\item |
| 194 |
% Have a nice environment-based commands in order to mimic the usual |
| 195 |
% theorem/proof structure. |
| 196 |
%\item |
| 197 |
% Separate the main article and the body in two documents (some journals |
| 198 |
% may ask for a separate file for the appendix) |
| 199 |
%\end{itemize} |
| 200 |
% |
| 201 |
%NB: This project is hosted on github at |
| 202 |
%\url{https://github.com/leo-colisson/proof-at-the-end} . Feel free to |
| 203 |
%contribute, report bugs, or read/copy-paste the documentation/examples |
| 204 |
%from there. |
| 205 |
% |
| 206 |
%Disclaimer: This package is still in beta and not considered as stable. |
| 207 |
% |
| 208 |
%This package is licensed under LPPL v1.3, and the last version of this |
| 209 |
%package on CTAN is 2019/05/21. |
| 210 |
% |
| 211 |
%\section{Demo}\label{demo} |
| 212 |
% |
| 213 |
%If you just want to see an example of what you can do, you can directly |
| 214 |
%open the file \texttt{demo.pdf} (also available online at |
| 215 |
%\url{https://github.com/leo-colisson/proof-at-the-end/raw/master/demo.pdf}) |
| 216 |
%to see what is possible, or generate it with |
| 217 |
% |
| 218 |
%\begin{Shaded} |
| 219 |
%\begin{Highlighting}[] |
| 220 |
%\FunctionTok{git}\NormalTok{ clone https://github.com/leo{-}colisson/proof{-}at{-}the{-}end.git} |
| 221 |
%\ExtensionTok{pdflatex}\NormalTok{ demo.tex }\KeywordTok{\&\&} \ExtensionTok{pdflatex}\NormalTok{ demo.tex} |
| 222 |
%\end{Highlighting} |
| 223 |
%\end{Shaded} |
| 224 |
% |
| 225 |
%\section{Quickstart}\label{quickstart} |
| 226 |
% |
| 227 |
%\subsection{Super Quick QuickStart}\label{super-quick-quickstart} |
| 228 |
% |
| 229 |
%If \texttt{proof-at-the-end} it's not installed in your CTAN |
| 230 |
%distribution, copy the |
| 231 |
%\href{https://github.com/leo-colisson/proof-at-the-end/}{\texttt{proof-at-the-end.sty} |
| 232 |
%file} in your project. Then, in your project, create new theorem/lemma |
| 233 |
%environments (using any tool you like, like asmthm, ntheorem and |
| 234 |
%thmtools), just, until |
| 235 |
%\href{https://github.com/muzimuzhi/thmtools/issues/70}{this upstream |
| 236 |
%\texttt{thmtool} bug} is fixed, links will be broken unless you do one |
| 237 |
%of the following actions: - call |
| 238 |
%\texttt{\textbackslash{}hypersetup\{hypertexnames=false\}} at the end of |
| 239 |
%the preamble (but this may fails if you build an index), - or, possibly |
| 240 |
%cleaner, if you use something like |
| 241 |
%\texttt{\textbackslash{}newtheorem\{thm\}\{Theorem\}{[}section{]}}, then |
| 242 |
%you must call |
| 243 |
%\texttt{\textbackslash{}renewcommand\textbackslash{}theHthm\{\textbackslash{}thesection\ .\textbackslash{}arabic\ \{thm\}\}}. |
| 244 |
%If you are unhappy with these workarounds, raise your voice in the above |
| 245 |
%\texttt{thmtool} issue. |
| 246 |
% |
| 247 |
%Then, load the library using |
| 248 |
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}} |
| 249 |
%(note that you need the version 2022/01/28 to have |
| 250 |
%\texttt{createShortEnv} defined, otherwise you need to use directly |
| 251 |
%\texttt{theoremEnd}) and write your theorem using: |
| 252 |
% |
| 253 |
%\begin{Shaded} |
| 254 |
%\begin{Highlighting}[] |
| 255 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} |
| 256 |
%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).} |
| 257 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 258 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 259 |
%\NormalTok{ And I am a proof.} |
| 260 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 261 |
%\end{Highlighting} |
| 262 |
%\end{Shaded} |
| 263 |
% |
| 264 |
%The options (here \texttt{restate} and \texttt{end}) tells what should |
| 265 |
%go in appendix, how to configure the links\ldots{} Here the proof should |
| 266 |
%go in appendix, and the \texttt{restate} options states that the theorem |
| 267 |
%should be restated before the proof. Note that in case you don't want |
| 268 |
%any title but do want to add options, make sure to insert an empty pair |
| 269 |
%of brackets like in |
| 270 |
%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}end,\ text\ link={]}} (the |
| 271 |
%option \texttt{text\ link} is used to choose the text of the link to the |
| 272 |
%proof, writting \texttt{text\ link=} is used to display no link at all). |
| 273 |
% |
| 274 |
%You can find below a full example to compile which should produce this |
| 275 |
%output (sorry, this is a screenshot, that way I can export it easily in |
| 276 |
%the github page). Just make sure to compile twice to get references. |
| 277 |
% |
| 278 |
%\begin{figure} |
| 279 |
%\centering |
| 280 |
%\pandocbounded{\includegraphics[keepaspectratio,alt={Screenshot of the quickstart}]{screenshot.png}} |
| 281 |
%\caption{Screenshot of the quickstart} |
| 282 |
%\end{figure} |
| 283 |
% |
| 284 |
%You can directly copy them (with a more complete demo) in the github |
| 285 |
%page here https://github.com/leo-colisson/proof-at-the-end/. |
| 286 |
% |
| 287 |
%\begin{Shaded} |
| 288 |
%\begin{Highlighting}[] |
| 289 |
%\BuiltInTok{\textbackslash{}documentclass}\NormalTok{\{}\ExtensionTok{article}\NormalTok{\}} |
| 290 |
% |
| 291 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{xparse}\NormalTok{\} }\CommentTok{\% Not needed with recent LaTeX} |
| 292 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amsthm}\NormalTok{\}} |
| 293 |
% |
| 294 |
%\CommentTok{\% Create new theorems, or use ntheorem/thmtools/...} |
| 295 |
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]} |
| 296 |
%\CommentTok{\% Default uses autoref, but you can also use cleveref, see the documentation.} |
| 297 |
%\CommentTok{\% Say to autoref that "thm" are Theorems.} |
| 298 |
%\FunctionTok{\textbackslash{}newcommand}\NormalTok{\{}\ExtensionTok{\textbackslash{}thmautorefname}\NormalTok{\}\{Theorem\}} |
| 299 |
% |
| 300 |
%\CommentTok{\%\% Load the library. createShortEnv automatically creates the shortcuts} |
| 301 |
%\CommentTok{\%\% thmE, theoremE, lemmaE, propositionE, corollaryE, proofE. See \textbackslash{}newEndThm for more details.} |
| 302 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} |
| 303 |
% |
| 304 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}} |
| 305 |
% |
| 306 |
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Theorems\}} |
| 307 |
% |
| 308 |
%\CommentTok{\%\% If you don\textquotesingle{}t have any title, leave an empty bracket like \textbackslash{}begin\{thmE\}[][end]} |
| 309 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} |
| 310 |
%\NormalTok{ I am a theorem} |
| 311 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 312 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 313 |
%\NormalTok{ And I am a proof.} |
| 314 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 315 |
% |
| 316 |
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Proofs\}} |
| 317 |
%\FunctionTok{\textbackslash{}printProofs} |
| 318 |
% |
| 319 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{document}\NormalTok{\}} |
| 320 |
%\end{Highlighting} |
| 321 |
%\end{Shaded} |
| 322 |
% |
| 323 |
%\subsection{Install}\label{install} |
| 324 |
% |
| 325 |
%If your CTAN distribution is recent enough, you have nothing to do (if |
| 326 |
%you are using overleaf, note that you can configure your project to use |
| 327 |
%a more recent TexLive distribution: this packages is included starting |
| 328 |
%from TexLive 2019). Otherwise if it's not yet in your CTAN distribution, |
| 329 |
%first download the \texttt{proof-at-the-end.sty} file and insert it in |
| 330 |
%the root of your project with the following commands on unix (you can |
| 331 |
%also clone this repository if you prefer, or just manually download or |
| 332 |
%copy/paste the files on Windows). |
| 333 |
% |
| 334 |
%\begin{Shaded} |
| 335 |
%\begin{Highlighting}[] |
| 336 |
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} |
| 337 |
%\VariableTok{repopratend}\OperatorTok{=}\StringTok{"https://raw.githubusercontent.com/leo{-}colisson/proof{-}at{-}the{-}end"} |
| 338 |
%\FunctionTok{wget} \VariableTok{$\{repopratend\}}\NormalTok{/master/proof{-}at{-}the{-}end.sty} |
| 339 |
%\end{Highlighting} |
| 340 |
%\end{Shaded} |
| 341 |
% |
| 342 |
%It also requires a recent version of xparse (not present in TexLive 2018 |
| 343 |
%and before basically), otherwise you will get an error like: |
| 344 |
% |
| 345 |
%\begin{verbatim} |
| 346 |
%Unknown argument type 'b' replaced by 'm' |
| 347 |
%\end{verbatim} |
| 348 |
% |
| 349 |
%While |
| 350 |
%\href{https://raw.githubusercontent.com/leo-colisson/proof-at-the-end/c2150f4feba4709d47e43c00e5f8eb93ce345cab/xparse.sty}{we |
| 351 |
%used to provide} for simplicity a \texttt{xparse.sty} file (version |
| 352 |
%\texttt{2018-04-12}) in older versions of this repository, we removed it |
| 353 |
%to |
| 354 |
%\href{https://github.com/leo-colisson/proof-at-the-end/issues/6}{avoid |
| 355 |
%license issues and conflicts with recent LaTeX distributions that |
| 356 |
%already include xparse}. Nevertheless, if you are using an older |
| 357 |
%distribution, you can also download \texttt{xparse} manually |
| 358 |
%\href{http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip}{here}, |
| 359 |
%unzip it, and copy the \texttt{.sty} files contained in |
| 360 |
%\texttt{tex/latex/l3packages/xparse/} at the root of your project. On |
| 361 |
%linux, you can do that via: |
| 362 |
% |
| 363 |
%\begin{Shaded} |
| 364 |
%\begin{Highlighting}[] |
| 365 |
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} |
| 366 |
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3packages.tds.zip} |
| 367 |
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3packages.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3packages/xparse/*\textquotesingle{}} |
| 368 |
%\FunctionTok{rm} \AttributeTok{{-}f}\NormalTok{ l3packages.tds.zip xparse.ltx} |
| 369 |
%\end{Highlighting} |
| 370 |
%\end{Shaded} |
| 371 |
% |
| 372 |
%If you have an old distribution of LaTeX (2017 or before basically), you |
| 373 |
%may also need a |
| 374 |
%\href{https://tex.stackexchange.com/questions/489646/expl3-and-recent-xparse-on-overleaf-no-expl3-loader-detected/489649?noredirect=1\#comment1236409_489649}{more |
| 375 |
%recent expl3} or you will get an error like: |
| 376 |
% |
| 377 |
%\begin{verbatim} |
| 378 |
%Package xparse Error: Support package l3kernel too old. |
| 379 |
%\end{verbatim} |
| 380 |
% |
| 381 |
%To install it, download the zip files |
| 382 |
%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip} |
| 383 |
%and |
| 384 |
%\url{http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip} |
| 385 |
%(\texttt{l3backend} is |
| 386 |
%\href{https://tex.stackexchange.com/questions/499082/file-l3backend-pdfmode-def-not-found-when-loading-expl3}{since |
| 387 |
%July 1st, 2019} a dependency of l3kernel), unzip, and copy the content |
| 388 |
%of the directories \texttt{tex/latex/l3kernel/} (first archive) and |
| 389 |
%\texttt{tex/latex/l3backend/} (second archive) into your project. On |
| 390 |
%linux it's a matter of two commands in your project: |
| 391 |
% |
| 392 |
%\begin{Shaded} |
| 393 |
%\begin{Highlighting}[] |
| 394 |
%\BuiltInTok{cd} \OperatorTok{\textless{}}\NormalTok{your project}\OperatorTok{\textgreater{}} |
| 395 |
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3kernel.tds.zip} |
| 396 |
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3kernel.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3kernel/*\textquotesingle{}} |
| 397 |
%\FunctionTok{rm}\NormalTok{ l3kernel.tds.zip} |
| 398 |
%\FunctionTok{wget}\NormalTok{ http://mirrors.ctan.org/install/macros/latex/contrib/l3backend.tds.zip} |
| 399 |
%\FunctionTok{unzip} \AttributeTok{{-}d}\NormalTok{ . }\AttributeTok{{-}j}\NormalTok{ l3backend.tds.zip }\StringTok{\textquotesingle{}tex/latex/l3backend/*\textquotesingle{}} |
| 400 |
%\FunctionTok{rm}\NormalTok{ l3backend.tds.zip} |
| 401 |
%\end{Highlighting} |
| 402 |
%\end{Shaded} |
| 403 |
% |
| 404 |
%If you don't want to pollute your main project with all these files, you |
| 405 |
%may be interested to put them in a subfolder and update the environment |
| 406 |
%variable \texttt{TEXINPUTS} or, if you use latexmk or overleaf, you can |
| 407 |
%write instead a \texttt{latexmkrc} file as explained |
| 408 |
%\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}. |
| 409 |
% |
| 410 |
%If you still have errors, it's likely that your LaTeX distribution is |
| 411 |
%just too old (LaTeX 2016 seems to be too old to install a recent l3exp). |
| 412 |
%So just upgrade to a decent version, and you should not have any |
| 413 |
%troubles anymore. |
| 414 |
% |
| 415 |
%You can test your install by compiling the \texttt{demo.tex} file |
| 416 |
%present in the repository. When it compiles, you are ready to start! |
| 417 |
% |
| 418 |
%\subsection{Use in your project}\label{use-in-your-project} |
| 419 |
% |
| 420 |
%Now, you can load the library in your project by simply using: |
| 421 |
% |
| 422 |
%\begin{Shaded} |
| 423 |
%\begin{Highlighting}[] |
| 424 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} |
| 425 |
%\end{Highlighting} |
| 426 |
%\end{Shaded} |
| 427 |
% |
| 428 |
%Then, you can configure your theorem/lemma/\ldots{} environments as |
| 429 |
%usual, by using any counter you like\ldots: |
| 430 |
% |
| 431 |
%\begin{Shaded} |
| 432 |
%\begin{Highlighting}[] |
| 433 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{amssymb, amsthm, amsmath}\NormalTok{\}} |
| 434 |
%\CommentTok{\% Theorems} |
| 435 |
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{thm\}\{Theorem\}[section]} |
| 436 |
%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{thm*\}\{Theorem\}} |
| 437 |
%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}thmautorefname}\NormalTok{\{Theorem\}} |
| 438 |
%\CommentTok{\% Lemmata} |
| 439 |
%\FunctionTok{\textbackslash{}newtheorem}\NormalTok{\{lemma\}[thm]\{Lemma\}} |
| 440 |
%\FunctionTok{\textbackslash{}newtheorem*}\NormalTok{\{lemma*\}\{Lemma\}} |
| 441 |
%\FunctionTok{\textbackslash{}providecommand*\textbackslash{}lemmaautorefname}\NormalTok{\{Lemma\}} |
| 442 |
%\end{Highlighting} |
| 443 |
%\end{Shaded} |
| 444 |
% |
| 445 |
%And inside your document, you can use the following syntax to create a |
| 446 |
%new theorem: |
| 447 |
% |
| 448 |
%\begin{Shaded} |
| 449 |
%\begin{Highlighting}[] |
| 450 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[OPTIONS]\{THEOREM ENVIRONMENT\}[OPTIONAL TITLE]} |
| 451 |
%\NormalTok{ YOUR THEOREM, with eventually labels like }\KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:OPTIONAL LABEL}\NormalTok{\}} |
| 452 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 453 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\} }\CommentTok{\%\% Optional environment} |
| 454 |
%\NormalTok{ YOUR (OPTIONAL) PROOF} |
| 455 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 456 |
%\end{Highlighting} |
| 457 |
%\end{Shaded} |
| 458 |
% |
| 459 |
%For example: |
| 460 |
% |
| 461 |
%\begin{Shaded} |
| 462 |
%\begin{Highlighting}[] |
| 463 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}\{thm\}[Yes I can have a title]} |
| 464 |
% \KeywordTok{\textbackslash{}label}\NormalTok{\{}\ExtensionTok{thm:ilikelabels}\NormalTok{\}} |
| 465 |
%\NormalTok{ Creating a new theorem is easy} |
| 466 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 467 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 468 |
%\NormalTok{ You want a proof? Here is it!} |
| 469 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 470 |
%\end{Highlighting} |
| 471 |
%\end{Shaded} |
| 472 |
% |
| 473 |
%Since \texttt{theoremEnd} may be a bit verbose to use, we provide since |
| 474 |
%the version 2022/01/28, an option: if you load the program using |
| 475 |
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}}, |
| 476 |
%you will automatically have the shortcut environments \texttt{proofE} |
| 477 |
%(to replace \texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), |
| 478 |
%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), |
| 479 |
%\texttt{lemmaE}, \texttt{propositionE} and \texttt{corollaryE}. Note |
| 480 |
%that it is your role to define the initial commands \texttt{thm}\ldots, |
| 481 |
%but you don't need to define them all, only those that you use. Then, |
| 482 |
%you can use them like: |
| 483 |
% |
| 484 |
%\begin{Shaded} |
| 485 |
%\begin{Highlighting}[] |
| 486 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[My title][end, restate]} |
| 487 |
%\NormalTok{ I am a restated theorem whose proof goes in appendix (compile me twice).} |
| 488 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 489 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 490 |
%\NormalTok{ And I am a proof.} |
| 491 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 492 |
%\end{Highlighting} |
| 493 |
%\end{Shaded} |
| 494 |
% |
| 495 |
%Finally, to display the proofs, just use |
| 496 |
%\texttt{\textbackslash{}printProofs} where you like: |
| 497 |
% |
| 498 |
%\begin{Shaded} |
| 499 |
%\begin{Highlighting}[] |
| 500 |
%\FunctionTok{\textbackslash{}printProofs} |
| 501 |
%\end{Highlighting} |
| 502 |
%\end{Shaded} |
| 503 |
% |
| 504 |
%If you would like to display a lemma instead, just change |
| 505 |
%\texttt{\{thm\}} into \texttt{\{lemma\}}, or into any other theorem |
| 506 |
%environment you defined! You can now compile safely your document ;) |
| 507 |
% |
| 508 |
%NB: if you want to make sure all the references are linked correctly, |
| 509 |
%make sure to compile twice the document! |
| 510 |
% |
| 511 |
%Isn't it simple ? |
| 512 |
% |
| 513 |
%\subsection{\texorpdfstring{A note on |
| 514 |
%\texttt{hyperref}}{A note on hyperref}}\label{a-note-on-hyperref} |
| 515 |
% |
| 516 |
%An older version of the package explicitely loaded \texttt{hyperref} |
| 517 |
%with no option, and an option clash could occur if the user wanted to |
| 518 |
%add options to \texttt{hyperref}. We now push the loading to the very |
| 519 |
%end to avoid that issue, but if you want to load packages \emph{after} |
| 520 |
%\texttt{hyperref} (like \texttt{cleveref}), it is your job to include |
| 521 |
%\texttt{hyperref}, for example by putting at the end of the preambule |
| 522 |
%something like: |
| 523 |
% |
| 524 |
%\begin{Shaded} |
| 525 |
%\begin{Highlighting}[] |
| 526 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[colorlinks]\{}\ExtensionTok{hyperref}\NormalTok{\}} |
| 527 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{\{}\ExtensionTok{cleveref}\NormalTok{\}} |
| 528 |
%\end{Highlighting} |
| 529 |
%\end{Shaded} |
| 530 |
% |
| 531 |
%\section{Use cases}\label{use-cases} |
| 532 |
% |
| 533 |
%\subsection{Configuration and how to use and create |
| 534 |
%styles}\label{configuration-and-how-to-use-and-create-styles} |
| 535 |
% |
| 536 |
%You can very easily configure this package, and choose how each |
| 537 |
%theorem/proof must be displayed by providing a value in |
| 538 |
%\texttt{OPTIONS}. For example, if you would like to keep the proof of a |
| 539 |
%theorem in the main text like any normal theorem, use the |
| 540 |
%\texttt{normal} option. |
| 541 |
% |
| 542 |
%\begin{Shaded} |
| 543 |
%\begin{Highlighting}[] |
| 544 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[normal]\{thm\}[A title]} |
| 545 |
%\NormalTok{ You can easily turn a theorem back into a normal theorem!} |
| 546 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 547 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 548 |
%\NormalTok{ And keep the proof with you!} |
| 549 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 550 |
%\end{Highlighting} |
| 551 |
%\end{Shaded} |
| 552 |
% |
| 553 |
%If you loaded the package using |
| 554 |
%\texttt{\textbackslash{}usepackage{[}createShortEnv{]}\{proof-at-the-end\}} |
| 555 |
%(starting from 2022/01/28), you also have preconfigured shortcuts for |
| 556 |
%multiple environments, namely \texttt{proofE} (to replace |
| 557 |
%\texttt{proof}), \texttt{thmE} (to replace \texttt{thm}), |
| 558 |
%\texttt{theoremE} (to replace\ldots{} ok you got the pattern), |
| 559 |
%\texttt{lemmaE}, \texttt{propositionE}, \texttt{propertyE}, |
| 560 |
%\texttt{factE} and \texttt{corollaryE}. This way, you can simplify the |
| 561 |
%above as: |
| 562 |
% |
| 563 |
%\begin{Shaded} |
| 564 |
%\begin{Highlighting}[] |
| 565 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[A title][normal]} |
| 566 |
%\NormalTok{ You can easily turn a theorem back into a normal theorem!} |
| 567 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 568 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 569 |
%\NormalTok{ And keep the proof with you!} |
| 570 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 571 |
%\end{Highlighting} |
| 572 |
%\end{Shaded} |
| 573 |
% |
| 574 |
%(You can of course remove the \texttt{{[}...{]}} containing the options |
| 575 |
%and the title, however if you want to add options without any title, |
| 576 |
%\textbf{make sure to use empty brackets for the title}, like |
| 577 |
%\texttt{\textbackslash{}begin\{thmE\}{[}{]}{[}normal{]}}. |
| 578 |
% |
| 579 |
%Since 2022/01/28, you can also create new theorem environment that |
| 580 |
%directly come with a preconfigured style (you may also find |
| 581 |
%\texttt{\textbackslash{}pratendSetLocal} useful if you want to change |
| 582 |
%the style in a whole section). For instance to create a |
| 583 |
%\texttt{thmNormal} environment having the \texttt{normal} option and a |
| 584 |
%\texttt{thmSpecial} environment having the |
| 585 |
%\texttt{all\ end,\ category=mySpecial} options, just do: |
| 586 |
% |
| 587 |
%\begin{verbatim} |
| 588 |
%\newEndThm[normal]{thmNormal}{thm} % 'thm' is the name of the existing thm environment |
| 589 |
%\newEndThm[all end, category=mySpecial]{thmSpecial}{thm} |
| 590 |
%\end{verbatim} |
| 591 |
% |
| 592 |
%This way, you can simply use |
| 593 |
%\texttt{\textbackslash{}begin\{thmSpecial\}{[}Special\ title{]}\ ...\ \textbackslash{}end\{thmSpecial\}} |
| 594 |
%to create a theorem going in the special category (see below). (you also |
| 595 |
%have \texttt{\textbackslash{}newEndProof{[}options{]}\{newProofEnv\}} to |
| 596 |
%define new proofs, but it is less useful as options are typically given |
| 597 |
%in the theorem). |
| 598 |
% |
| 599 |
%The options are in fact a set of keys/values, thanks to |
| 600 |
%\texttt{pgfkeys}. So you can combine them with comma separated list like |
| 601 |
%that (order matters, as the right-most values may overwrite |
| 602 |
%configuration set by left-most values): |
| 603 |
% |
| 604 |
%\begin{Shaded} |
| 605 |
%\begin{Highlighting}[] |
| 606 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[proof at the end,} |
| 607 |
%\NormalTok{ no link to proof,} |
| 608 |
%\NormalTok{ text proof=\{Difficult proof\}} |
| 609 |
%\NormalTok{ ]\{thm\}[A title]} |
| 610 |
%\NormalTok{ Each theorem can have a custom configuration!} |
| 611 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 612 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 613 |
%\NormalTok{ Quite practical, isn\textquotesingle{}t it?} |
| 614 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 615 |
%\end{Highlighting} |
| 616 |
%\end{Shaded} |
| 617 |
% |
| 618 |
%You can easily create your own styles like that: |
| 619 |
% |
| 620 |
%\begin{Shaded} |
| 621 |
%\begin{Highlighting}[] |
| 622 |
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/my great style/.style=\{} |
| 623 |
%\NormalTok{ proot at the end,} |
| 624 |
%\NormalTok{ no link to proof,} |
| 625 |
%\NormalTok{ text proof=\{Difficult proof\},} |
| 626 |
%\NormalTok{ \}} |
| 627 |
%\NormalTok{\}} |
| 628 |
%\end{Highlighting} |
| 629 |
%\end{Shaded} |
| 630 |
% |
| 631 |
%You can also change the default configuration when you load the package |
| 632 |
%by nesting the configuration into a \texttt{conf} key: |
| 633 |
% |
| 634 |
%\begin{Shaded} |
| 635 |
%\begin{Highlighting}[] |
| 636 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[conf=\{normal, one big link\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} |
| 637 |
%\end{Highlighting} |
| 638 |
%\end{Shaded} |
| 639 |
% |
| 640 |
%Note however that for now it is \emph{not} possible to use macros |
| 641 |
%directly inside the options when you load the package, so if you need to |
| 642 |
%use more complicated configuration, you can overwrite the |
| 643 |
%\texttt{global\ custom\ defaults} style for global configuration, and |
| 644 |
%the \texttt{local\ custom\ defaults} style for local configuration |
| 645 |
%(useful for example if you want to define a category for a single |
| 646 |
%section): |
| 647 |
% |
| 648 |
%\begin{Shaded} |
| 649 |
%\begin{Highlighting}[] |
| 650 |
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/global custom defaults/.style=\{} |
| 651 |
%\NormalTok{ one big link=\{Go to proof on page\textasciitilde{}}\FunctionTok{\textbackslash{}pageref*}\NormalTok{\{proof:prAtEnd}\FunctionTok{\textbackslash{}pratendcountercurrent}\NormalTok{\}\}} |
| 652 |
%\NormalTok{ \}} |
| 653 |
%\NormalTok{\}} |
| 654 |
%\end{Highlighting} |
| 655 |
%\end{Shaded} |
| 656 |
% |
| 657 |
%or, for short (needs version \textgreater{} 2022/02/04): |
| 658 |
% |
| 659 |
%\begin{Shaded} |
| 660 |
%\begin{Highlighting}[] |
| 661 |
%\FunctionTok{\textbackslash{}pratendSetGlobal}\NormalTok{\{one big link="blabla"\}} |
| 662 |
%\end{Highlighting} |
| 663 |
%\end{Shaded} |
| 664 |
% |
| 665 |
%and for local configuration: |
| 666 |
% |
| 667 |
%\begin{Shaded} |
| 668 |
%\begin{Highlighting}[] |
| 669 |
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/local custom defaults/.style=\{} |
| 670 |
%\NormalTok{ category=greattheorem} |
| 671 |
%\NormalTok{ \}} |
| 672 |
%\NormalTok{\}} |
| 673 |
%\end{Highlighting} |
| 674 |
%\end{Shaded} |
| 675 |
% |
| 676 |
%for short (needs version \textgreater{} 2022/02/04): |
| 677 |
% |
| 678 |
%\begin{Shaded} |
| 679 |
%\begin{Highlighting}[] |
| 680 |
%\FunctionTok{\textbackslash{}pratendSetLocal}\NormalTok{\{category=greattheorem\}} |
| 681 |
%\end{Highlighting} |
| 682 |
%\end{Shaded} |
| 683 |
% |
| 684 |
%Then you can use like that: |
| 685 |
% |
| 686 |
%\begin{Shaded} |
| 687 |
%\begin{Highlighting}[] |
| 688 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title]} |
| 689 |
%\NormalTok{ Here is a normal theorem with the proof in the main text.} |
| 690 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 691 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 692 |
%\NormalTok{ The (optional) proof} |
| 693 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 694 |
% |
| 695 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][end]} |
| 696 |
%\NormalTok{ Here is a theorem whose proof goes to the end.} |
| 697 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 698 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 699 |
%\NormalTok{ The proof} |
| 700 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 701 |
% |
| 702 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}[Title][all end]} |
| 703 |
%\NormalTok{ Here is a theorem that goes with the proof at the end.} |
| 704 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 705 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 706 |
%\NormalTok{ The proof} |
| 707 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofE}\NormalTok{\}} |
| 708 |
%\end{Highlighting} |
| 709 |
%\end{Shaded} |
| 710 |
% |
| 711 |
%Note also that it is possible to give options to the \texttt{proofEnd} |
| 712 |
%environment, but it is usually useless, as it will automatically pick |
| 713 |
%the parameters from the last \texttt{theoremEnd} environment. However, |
| 714 |
%if for some reasons you want to change the options of the proof only, |
| 715 |
%you can do it, but do it as your own risks ;) |
| 716 |
% |
| 717 |
%\subsection{Usual styles}\label{usual-styles} |
| 718 |
% |
| 719 |
%We predefined some pretty common styles/options. The full list is at the |
| 720 |
%end of this document, but here is a list of the most practical ones: |
| 721 |
% |
| 722 |
%\begin{itemize} |
| 723 |
%\tightlist |
| 724 |
%\item |
| 725 |
% \texttt{normal}: turn the theorem into a ``normal'' theorem, with the |
| 726 |
% proof in the main text and nothing in appendix |
| 727 |
%\item |
| 728 |
% \texttt{category=yourowncategory}: change the category of the theorem |
| 729 |
% (see next sub-section) |
| 730 |
%\item |
| 731 |
% \texttt{end}: put the proof in appendix |
| 732 |
%\item |
| 733 |
% \texttt{all\ end}: put both the theorem and the proof in appendix |
| 734 |
%\item |
| 735 |
% \texttt{debug}: make sure the proof is written in the main text as |
| 736 |
% well. Practical when you write the proof to be able to use synctex (if |
| 737 |
% you use synctex with the proof in appendix, your will be unfortunately |
| 738 |
% moved to a temporary file that this library is using\ldots{} so |
| 739 |
% \textbf{make sure you don't modify the files named like |
| 740 |
% \texttt{*prattheenddefaultcategory.tex} or all your changes will be |
| 741 |
% lost at the next compilation}!). |
| 742 |
%\item |
| 743 |
% \texttt{one\ big\ link}: if you prefer to have a single big link |
| 744 |
% instead of two links (one for the proof, one for the page) |
| 745 |
%\item |
| 746 |
% \texttt{one\ big\ link\ translated=Your\ translation}: to |
| 747 |
% change/translate the text of the link easily |
| 748 |
%\item |
| 749 |
% \texttt{text\ link\ section}: put a link looking like ``See proof in |
| 750 |
% section XX.''. You can use \texttt{text\ link=} to remove this link. |
| 751 |
%\item |
| 752 |
% \texttt{text\ link\ section\ full\ proof}: put a link looking like |
| 753 |
% ``See full proof in section XX.'' |
| 754 |
%\item |
| 755 |
% \texttt{text\ proof\ translated=Your\ translation}: to |
| 756 |
% change/translate the text of the proof at the end easily |
| 757 |
%\item |
| 758 |
% \texttt{global\ custom\ defaults}: empty style that you can modify to |
| 759 |
% change the configuration (globally) |
| 760 |
%\item |
| 761 |
% \texttt{local\ custom\ defaults}: empty style that you can modify to |
| 762 |
% change the configuration (locally). Practical to set a category for a |
| 763 |
% single section. |
| 764 |
%\end{itemize} |
| 765 |
% |
| 766 |
%\subsection{Categories, or how to move proofs in different |
| 767 |
%sections}\label{categories-or-how-to-move-proofs-in-different-sections} |
| 768 |
% |
| 769 |
%Let's imagine that you have some proofs that are easy to do, and some |
| 770 |
%proofs that are long but interesting. You may want to put the easy |
| 771 |
%proofs in a different place that the long proofs. It is super easy to |
| 772 |
%do, you just need to give a category name to the option |
| 773 |
%\texttt{category} like here: |
| 774 |
% |
| 775 |
%\begin{Shaded} |
| 776 |
%\begin{Highlighting}[] |
| 777 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[category=mylongproofs]\{thm\}[A title]} |
| 778 |
%\NormalTok{ You can easily change the place of the proofs} |
| 779 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 780 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 781 |
%\NormalTok{ Just use a different category name!} |
| 782 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 783 |
%\end{Highlighting} |
| 784 |
%\end{Shaded} |
| 785 |
% |
| 786 |
%and give this category name to \texttt{\textbackslash{}printProofs} in |
| 787 |
%the section where you would like to display the proofs: |
| 788 |
% |
| 789 |
%\begin{Shaded} |
| 790 |
%\begin{Highlighting}[] |
| 791 |
%\FunctionTok{\textbackslash{}printProofs}\NormalTok{[mylongproofs]} |
| 792 |
%\end{Highlighting} |
| 793 |
%\end{Shaded} |
| 794 |
% |
| 795 |
%\subsection{Comments}\label{comments} |
| 796 |
% |
| 797 |
%You can also move some text in the appendix by using: |
| 798 |
% |
| 799 |
%\begin{Shaded} |
| 800 |
%\begin{Highlighting}[] |
| 801 |
%\FunctionTok{\textbackslash{}textEnd}\NormalTok{\{Your text that should go in appendix\}} |
| 802 |
%\end{Highlighting} |
| 803 |
%\end{Shaded} |
| 804 |
% |
| 805 |
%You can also give it a category as explained above, or configure it to |
| 806 |
%be displayed in both the main text and at the end of the file with: |
| 807 |
% |
| 808 |
%\begin{Shaded} |
| 809 |
%\begin{Highlighting}[] |
| 810 |
%\FunctionTok{\textbackslash{}textEnd}\NormalTok{[both]\{I am a comment that is written in both the main text} |
| 811 |
%\NormalTok{and the appendix\}} |
| 812 |
%\end{Highlighting} |
| 813 |
%\end{Shaded} |
| 814 |
% |
| 815 |
%You can also use the environment notation like that: |
| 816 |
% |
| 817 |
%\begin{Shaded} |
| 818 |
%\begin{Highlighting}[] |
| 819 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}[options]} |
| 820 |
%\NormalTok{ You can also use the environment syntax.} |
| 821 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{textAtEnd}\NormalTok{\}} |
| 822 |
%\end{Highlighting} |
| 823 |
%\end{Shaded} |
| 824 |
% |
| 825 |
%\subsection{Restate a theorem}\label{restate-a-theorem} |
| 826 |
% |
| 827 |
%It is easy to restate a theorem in the appendix, to have both the |
| 828 |
%theorem in the main text and in the appendix: just use the option |
| 829 |
%\texttt{restate}: |
| 830 |
% |
| 831 |
%\begin{Shaded} |
| 832 |
%\begin{Highlighting}[] |
| 833 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[end, restate]\{thm\}[A title]} |
| 834 |
%\NormalTok{ This theorem will be displayed both in main text and appendix.} |
| 835 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 836 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 837 |
%\NormalTok{ Just use restate option.} |
| 838 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 839 |
%\end{Highlighting} |
| 840 |
%\end{Shaded} |
| 841 |
% |
| 842 |
%You can also use the option \texttt{restate\ command=yourcustomcommand} |
| 843 |
%in order to create a macro \texttt{\textbackslash{}yourcustomcommand} |
| 844 |
%that will restate the theorem wherever you want (but after the |
| 845 |
%definition). |
| 846 |
% |
| 847 |
%If you want to (re)state a theorem \emph{before} its definition (say in |
| 848 |
%the introduction), there is also a special environment |
| 849 |
%\texttt{theoremEndRestateBefore} that requires a (unique) custom name |
| 850 |
%that you need to provide also later on in place of the real theorem with |
| 851 |
%the option \texttt{restated\ before}: |
| 852 |
% |
| 853 |
%\begin{Shaded} |
| 854 |
%\begin{Highlighting}[] |
| 855 |
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Introduction\}} |
| 856 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}\{thm\}[Title]\{anamethatisusedtorestate\}} |
| 857 |
%\NormalTok{ It is possible to state the theorem before} |
| 858 |
%\NormalTok{ in the introduction, and restate it later} |
| 859 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEndRestateBefore}\NormalTok{\}} |
| 860 |
% |
| 861 |
%\KeywordTok{\textbackslash{}section}\NormalTok{\{Real definition\}} |
| 862 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[restated before]\{thm\}} |
| 863 |
%\NormalTok{ anamethatisusedtorestate} |
| 864 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 865 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 866 |
%\NormalTok{ Proof of the theorem, put in place of the theorem the unique name} |
| 867 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 868 |
%\end{Highlighting} |
| 869 |
%\end{Shaded} |
| 870 |
% |
| 871 |
%\subsection{Translate the links}\label{translate-the-links} |
| 872 |
% |
| 873 |
%The more powerful way to change the text of the links is to redefine |
| 874 |
%\texttt{text\ link} and \texttt{text\ proof} (see section List of |
| 875 |
%options for more details). However we defined also some easy way to |
| 876 |
%redefine the text using \texttt{one\ big\ link\ translated} and |
| 877 |
%\texttt{text\ proof\ translated}. For example, to create your |
| 878 |
%\texttt{french} style you can do: |
| 879 |
% |
| 880 |
%\begin{Shaded} |
| 881 |
%\begin{Highlighting}[] |
| 882 |
%\FunctionTok{\textbackslash{}pgfkeys}\NormalTok{\{/prAtEnd/french/.style=\{} |
| 883 |
%\NormalTok{ one big link translated=\{Voir preuve page\},} |
| 884 |
%\NormalTok{ text proof translated=\{Preuve du\}} |
| 885 |
%\NormalTok{ \}} |
| 886 |
%\NormalTok{\}} |
| 887 |
%\end{Highlighting} |
| 888 |
%\end{Shaded} |
| 889 |
% |
| 890 |
%\subsection{Write a sketch of proof in the main |
| 891 |
%text}\label{write-a-sketch-of-proof-in-the-main-text} |
| 892 |
% |
| 893 |
%You can include a sketch of proof in the main text by simply adding a |
| 894 |
%proof in between \texttt{theoremEnd} and \texttt{proofEnd}. An alias |
| 895 |
%option \texttt{see\ full\ proof} can also be used to change the link |
| 896 |
%into ``See full proof on page X.'': |
| 897 |
% |
| 898 |
%\begin{Shaded} |
| 899 |
%\begin{Highlighting}[] |
| 900 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}[see full proof]\{thm\}} |
| 901 |
%\NormalTok{ I can also write a sketch of proof, and put the full proof in appendix.} |
| 902 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{theoremEnd}\NormalTok{\}} |
| 903 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}} |
| 904 |
%\NormalTok{ Hint: look at the alias options.} |
| 905 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proof}\NormalTok{\}} |
| 906 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 907 |
%\NormalTok{ You just use \textasciigrave{}\textasciigrave{}see full proof\textquotesingle{}\textquotesingle{} as an option} |
| 908 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{proofEnd}\NormalTok{\}} |
| 909 |
%\end{Highlighting} |
| 910 |
%\end{Shaded} |
| 911 |
% |
| 912 |
%\subsection{Split the article in two documents, one for the main body |
| 913 |
%and one for the |
| 914 |
%appendix}\label{split-the-article-in-two-documents-one-for-the-main-body-and-one-for-the-appendix} |
| 915 |
% |
| 916 |
%Since 2022/02/04, it is possible to include the appendix in a separate |
| 917 |
%file. Internally, this library creates a new file having the form |
| 918 |
%\texttt{NAME\_OF\_FILE-pratendNAME\_CATEGORY.tex} containing the proofs |
| 919 |
%to include (then, \texttt{\textbackslash{}printProofs} only input that |
| 920 |
%file). You can input that file from other files if you want to separate |
| 921 |
%the body from the proof, but it won't work if you have restate theorems. |
| 922 |
%You should use the option \texttt{external\ appendix} (starting from |
| 923 |
%version 2022/02/04) to restate appropriately the theorem: |
| 924 |
% |
| 925 |
%\begin{Shaded} |
| 926 |
%\begin{Highlighting}[] |
| 927 |
%\BuiltInTok{\textbackslash{}usepackage}\NormalTok{[createShortEnv,conf=\{external appendix\}]\{}\ExtensionTok{proof{-}at{-}the{-}end}\NormalTok{\}} |
| 928 |
%\end{Highlighting} |
| 929 |
%\end{Shaded} |
| 930 |
% |
| 931 |
%Then, compile your main file and create a new file for the appendix, |
| 932 |
%load the theorems environments as for the main file, in the preambule |
| 933 |
%load the \texttt{xr} package to properly have references (otherwise you |
| 934 |
%won't have the appropriate number for the theorems) using something |
| 935 |
%like: |
| 936 |
% |
| 937 |
%\begin{verbatim} |
| 938 |
%\usepackage{xr} |
| 939 |
%\externaldocument{name_of_main_file_without_extension} |
| 940 |
%\end{verbatim} |
| 941 |
% |
| 942 |
%and in this new document just add the appendix wherever you want: |
| 943 |
% |
| 944 |
%\begin{Shaded} |
| 945 |
%\begin{Highlighting}[] |
| 946 |
%\FunctionTok{\textbackslash{}includeExternalAppendix}\NormalTok{\{name\_of\_main\_file\_without\_extension\}} |
| 947 |
%\end{Highlighting} |
| 948 |
%\end{Shaded} |
| 949 |
% |
| 950 |
%You can see an exemple in the github repository, with the two files |
| 951 |
%\texttt{demo\_external\_appendix.tex} and |
| 952 |
%\texttt{demo\_external\_appendix\_part2.tex}. Whenever your proofs |
| 953 |
%change in the main paper, make sure to compile first the main document |
| 954 |
%(so that the auxiliary file gets updated), and then compile the appendix |
| 955 |
%document. Note that you can still use |
| 956 |
%\texttt{\textbackslash{}printProofs} in the main document if you like |
| 957 |
%(while writting your paper, it is certainly easier to keep the proofs |
| 958 |
%and theorems in the same document). |
| 959 |
% |
| 960 |
%\section{List of options}\label{list-of-options} |
| 961 |
% |
| 962 |
%Here is the list of fundamental options supported. Most options have a |
| 963 |
%\texttt{no} version, with \texttt{no} written before. Note that you may |
| 964 |
%prefer to use directly the alias/styles (see next paragraph) as the |
| 965 |
%options listed here are quite fundamental and atomic. |
| 966 |
% |
| 967 |
%\begin{itemize} |
| 968 |
%\item |
| 969 |
% \texttt{category}: category of the proof (if you want to put proofs at |
| 970 |
% several places), can be anything |
| 971 |
%\item |
| 972 |
% \texttt{proof\ here}/\texttt{no\ proof\ here}: put (or not) the proof |
| 973 |
% in the main text |
| 974 |
%\item |
| 975 |
% \texttt{proof\ end}/\texttt{no\ proof\ end}: display the proof in |
| 976 |
% appendix |
| 977 |
%\item |
| 978 |
% \texttt{restate}/\texttt{no\ restate}: restate the theorem in appendix |
| 979 |
%\item |
| 980 |
% \texttt{link\ to\ proof}/\texttt{no\ link\ to\ proof}: Display a link |
| 981 |
% to the proof in the main text |
| 982 |
%\item |
| 983 |
% \texttt{opt\ all\ end}/\texttt{no\ opt\ all\ end}: put the theorem and |
| 984 |
% proof only in appendix. You may prefer the alias \texttt{all\ end}, |
| 985 |
% that also makes sure that the proof is indeed displayed in appendix. |
| 986 |
%\item |
| 987 |
% \texttt{text\ link}: text of the link to the proof, defaults to |
| 988 |
% |
| 989 |
% \texttt{\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} |
| 990 |
%\item |
| 991 |
% \texttt{text\ proof}: text displayed in place of ``Proof'' in the |
| 992 |
% appendix. Defaults to |
| 993 |
% \texttt{\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}} |
| 994 |
%\item |
| 995 |
% \texttt{restate\ command}: name of a unique macro (without backslash) |
| 996 |
% that will be defined as an alias to restate the theorem wherever you |
| 997 |
% want |
| 998 |
%\item |
| 999 |
% \texttt{restated\ before}: if the theorems has been stated before |
| 1000 |
% (with \texttt{\textbackslash{}theoremProofEndRestateBefore}), then we |
| 1001 |
% just need to put the restate command in place of the theorem, and |
| 1002 |
% enable this option |
| 1003 |
%\item |
| 1004 |
% \texttt{both}/\texttt{no\ both}: only for |
| 1005 |
% \texttt{\textbackslash{}textInAppendix}, specifies that the text must |
| 1006 |
% be present in both the main text and the appendix. |
| 1007 |
%\item |
| 1008 |
% \texttt{external\ appendix}: to ensure the appendix can be included in |
| 1009 |
% another file (see details above), starting from version 2022/02/04. |
| 1010 |
%\end{itemize} |
| 1011 |
% |
| 1012 |
%Here are all the alias/styles (you can create you own as well), they are |
| 1013 |
%practical to quickly define a behaviours, but are made of the basic |
| 1014 |
%options listed above: |
| 1015 |
% |
| 1016 |
%\begin{itemize} |
| 1017 |
%\tightlist |
| 1018 |
%\item |
| 1019 |
% \texttt{normal}: like a `normal' theorem, without any proof in the |
| 1020 |
% appendix, and with a proof displayed in the main text. Shortcut for |
| 1021 |
% \texttt{proof\ here,\ no\ all\ end,\ no\ proof\ end,\ no\ link\ to\ proof,\ no\ restate,\ no\ both}. |
| 1022 |
%\item |
| 1023 |
% \texttt{end}: theorems whose proof need to go in the appendix. Shorcut |
| 1024 |
% for \texttt{proof\ at\ the\ end,\ link\ to\ proof}. |
| 1025 |
%\item |
| 1026 |
% \texttt{all\ end}: makes sure both the theorem and the proof are in |
| 1027 |
% appendix. Alias of \texttt{end,\ opt\ all\ end}. |
| 1028 |
%\item |
| 1029 |
% \texttt{proof\ at\ the\ end}: theorems whose proof need to go in the |
| 1030 |
% appendix contrary to \texttt{end} it does not make sure that there is |
| 1031 |
% a link to the proof. Shorcut for |
| 1032 |
% \texttt{no\ proof\ here,\ no\ all\ end,\ proof\ end,\ no\ both}. |
| 1033 |
%\item |
| 1034 |
% \texttt{debug}: make sure the proof is written in the main text as |
| 1035 |
% well (alias of \texttt{proof\ here,\ no\ opt\ all\ end}), it is quite |
| 1036 |
% practical to use when you write a proof to be able to use synctex |
| 1037 |
% features to move between the pdf and the file. |
| 1038 |
%\item |
| 1039 |
% \texttt{no\ link\ to\ theorem}: Remove the link from the proof to the |
| 1040 |
% theorem, alias of \texttt{text\ proof=\{\textbackslash{}proofname\}} |
| 1041 |
%\item |
| 1042 |
% \texttt{stared} (or \texttt{no\ number}): when you use the stared |
| 1043 |
% version of a theorem you don't have any number, so cref fails to write |
| 1044 |
% a nice link to the theorem. This option changes the text of ``Proof'', |
| 1045 |
% by keeping the link but writting only \texttt{Proof}. Equivalent to |
| 1046 |
% \texttt{text\ proof=\{\textbackslash{}string\textbackslash{}mbox\{\textbackslash{}string\textbackslash{}hyperref{[}thm:prAtEnd\textbackslash{}pratendcountercurrent{]}\{\textbackslash{}proofname\}\}\}} |
| 1047 |
%\item |
| 1048 |
% \texttt{see\ full\ proof}: useful when you want to write in the main |
| 1049 |
% text only a sketch of proof, this alias writes a link |
| 1050 |
% \texttt{See\ full\ proof\ on\ page\ X.}. Equivalent to |
| 1051 |
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} |
| 1052 |
%\item |
| 1053 |
% \texttt{one\ big\ link}: instead of two links, one for page, one for |
| 1054 |
% proof, put just one link around everything. It can also accept an |
| 1055 |
% optional argument which will be the text of the link, like |
| 1056 |
% \texttt{one\ big\ link=Go\ to\ the\ proof}. The default value is |
| 1057 |
% \texttt{See\ proof\ on\ page\textasciitilde{}\textbackslash{}pageref*\{proof:prAtEnd\textbackslash{}pratendcountercurrent.\}}. |
| 1058 |
%\item |
| 1059 |
% \texttt{one\ big\ link\ translated}: This is like |
| 1060 |
% \texttt{one\ big\ link}, but automatically add the page at the end |
| 1061 |
% (and a big link around). Practical to quickly define a translation |
| 1062 |
% like \texttt{one\ big\ link\ translated=Voir\ preuve\ page}. See also |
| 1063 |
% \texttt{text\ proof\ translated}. |
| 1064 |
%\item |
| 1065 |
% \texttt{text\ link\ section}: Put a link to the proof looking like |
| 1066 |
% ``See proof in section X''. Defaults to |
| 1067 |
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}} |
| 1068 |
%\item |
| 1069 |
% \texttt{text\ link\ section\ full\ proof}: Put a link to the proof |
| 1070 |
% looking like ``See full proof in section X''. Defaults to |
| 1071 |
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{full\ proof\}\ in\ \textbackslash{}pratendSectionlikeCref.\}} |
| 1072 |
%\item |
| 1073 |
% \texttt{default\ text\ link}: default text for the link to the proof, |
| 1074 |
% equivalent of |
| 1075 |
% \texttt{text\ link=\{See\ \textbackslash{}hyperref{[}proof:prAtEnd\textbackslash{}pratendcountercurrent{]}\{proof\}\ on\ page\textasciitilde{}\textbackslash{}pageref\{proof:prAtEnd\textbackslash{}pratendcountercurrent\}.\}} |
| 1076 |
%\item |
| 1077 |
% \texttt{default\ text\ proof}: default text for the proof in appendix, |
| 1078 |
% equivalent of |
| 1079 |
% \texttt{text\ proof=\{Proof\ of\ \textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}} |
| 1080 |
%\item |
| 1081 |
% \texttt{text\ proof\ only\ theorem}: equivalent of |
| 1082 |
% \texttt{text\ proof=\{\textbackslash{}string\textbackslash{}pratendRef\{thm:prAtEnd\textbackslash{}pratendcountercurrent\}\}}, |
| 1083 |
% helpful if the class uses a custom proof environment that would write |
| 1084 |
% \texttt{Proof\ (Proof\ of\ Lemma\ X)} instead of |
| 1085 |
% \texttt{Proof\ of\ Lemma\ X.}: adding this style turns it into |
| 1086 |
% \texttt{Proof\ (Lemma\ X)}. See more details in the troubleshooting |
| 1087 |
% section. |
| 1088 |
%\item |
| 1089 |
% \texttt{text\ proof\ translated}: like \texttt{default\ text\ proof}, |
| 1090 |
% but takes one argument and use it instead of \texttt{Proof\ of}. |
| 1091 |
% Example: \texttt{text\ proof\ translated=\{Preuve\ du\}} |
| 1092 |
%\item |
| 1093 |
% \texttt{text\ link\ external\ appendix}: style used to configure the |
| 1094 |
% text to display when the appendix is in an external file. Defaults to |
| 1095 |
% \texttt{text\ link=\{The\ proof\ is\ in\ the\ appendix.\}}. |
| 1096 |
%\item |
| 1097 |
% \texttt{external\ appendix}: useful when the the proofs are moved in |
| 1098 |
% an external file (read more above). In particular, it will ensure that |
| 1099 |
% normal theorems are used instead of restate since restate does not |
| 1100 |
% work across files. This will also apply |
| 1101 |
% \texttt{text\ link\ external\ appendix} to change the text |
| 1102 |
% accordingly. |
| 1103 |
%\item |
| 1104 |
% \texttt{only\ external\ appendix}: like \texttt{external\ appendix}, |
| 1105 |
% but without changing the text. |
| 1106 |
%\item |
| 1107 |
% \texttt{bare\ defaults}: default style that is loaded before anything |
| 1108 |
% else that configure by default a link to the proof, put the proof in |
| 1109 |
% appendix, use the category \texttt{defaultcategory}. It is an alias of |
| 1110 |
% \texttt{end,\ link\ to\ proof,\ no\ restate,category=defaultcategory,\ default\ text\ link,default\ text\ proof,restate\ command=pratenddummymacro}. |
| 1111 |
%\item |
| 1112 |
% \texttt{configuration\ options}: style that contains the options used |
| 1113 |
% to load the package. It is called right after \texttt{bare\ defaults}. |
| 1114 |
% Note that you cannot insert macro in the options, overwrite |
| 1115 |
% \texttt{global\ custom\ defaults} instead |
| 1116 |
%\item |
| 1117 |
% \texttt{global\ custom\ defaults}: empty style that you can overwrite |
| 1118 |
% to change the global defaults |
| 1119 |
%\item |
| 1120 |
% \texttt{local\ custom\ defaults}: empty style that you can overwrite |
| 1121 |
% to change the ``local'' defaults, like category |
| 1122 |
%\item |
| 1123 |
% \texttt{all\ defaults}: all the defaults, equivalent of |
| 1124 |
% \texttt{bare\ defaults,\ configuration\ options,\ global\ custom\ defaults,\ local\ custom\ defaults} |
| 1125 |
%\end{itemize} |
| 1126 |
% |
| 1127 |
%\section{Package options}\label{package-options} |
| 1128 |
% |
| 1129 |
%The package comes with multiple options: - The |
| 1130 |
%\texttt{conf=\{CONFIGURATION\}} option is used to configure the default |
| 1131 |
%style. Usage: |
| 1132 |
%\texttt{\textbackslash{}usepackage{[}conf=\{normal,\ text\ link\ section\}{]}\{proof-at-the-end\}} |
| 1133 |
%- The \texttt{disablePatchSection} is useful to stop the library from |
| 1134 |
%patching the section-like commands and chapters (by default, we |
| 1135 |
%automatically add a \texttt{\textbackslash{}label} at the end of the |
| 1136 |
%section which is used by \texttt{text\ link\ section} to find the |
| 1137 |
%Appendix). If you enable this option, you can manually add the label by |
| 1138 |
%using \texttt{\textbackslash{}pratendAddLabel} after the appendix |
| 1139 |
%section (without any argument). - \texttt{commandRef=NAMECOMMAND}: By |
| 1140 |
%default, theorem are referenced to using |
| 1141 |
%\texttt{\textbackslash{}autoref\{\}}. You can change the value of |
| 1142 |
%\texttt{NAMECOMMAND} to use another command, like |
| 1143 |
%\texttt{commandRef=Cref} to use \texttt{\textbackslash{}Cref\{\}}. In |
| 1144 |
%that case, make sure to load both \texttt{hyperref} and |
| 1145 |
%\texttt{cleveref} (typically at the very end of your preambule) as |
| 1146 |
%\texttt{cleveref} needs to be loaded after \texttt{hyperref}. |
| 1147 |
%Internally, the library creates and uses |
| 1148 |
%\texttt{\textbackslash{}pratendRef} instead of |
| 1149 |
%\texttt{\textbackslash{}autoref}. - \texttt{createShortEnv}: creates |
| 1150 |
%(using \texttt{newEndThm} and \texttt{newEndProof}) the shortcut |
| 1151 |
%environments \texttt{proofE} (to replace \texttt{proof}), \texttt{thmE} |
| 1152 |
%(to replace \texttt{thm}), \texttt{theoremE} (to replace\ldots{} ok you |
| 1153 |
%got the pattern), \texttt{lemmaE} and \texttt{corollaryE}. Note that it |
| 1154 |
%is still your job to define the \texttt{thm}, \texttt{lemma} |
| 1155 |
%environments. |
| 1156 |
% |
| 1157 |
%\section{Troubleshooting}\label{troubleshooting} |
| 1158 |
% |
| 1159 |
%Here are some common issues you may have, with explainations to solve |
| 1160 |
%them. |
| 1161 |
% |
| 1162 |
%\subsection{The link after the proof does not mention the section, but |
| 1163 |
%something else (an equation, a figure, |
| 1164 |
%etc.)}\label{the-link-after-the-proof-does-not-mention-the-section-but-something-else-an-equation-a-figure-etc.} |
| 1165 |
% |
| 1166 |
%Sometimes, you may see something like |
| 1167 |
%\texttt{See\ proof\ in\ Equation\ A} instead of |
| 1168 |
%`\texttt{See\ proof\ in\ Appendix\ A}. This issue |
| 1169 |
%\href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{was |
| 1170 |
%reported before} and should be solved on newer versions (starting from |
| 1171 |
%2022/01/27) by automatically patching sections. If you have this issue, |
| 1172 |
%just upgrade (for instance by copying the |
| 1173 |
%\href{https://github.com/leo-colisson/proof-at-the-end}{\texttt{proof-at-the-end.sty} |
| 1174 |
%file} at the root of your project). We proceed by patching the |
| 1175 |
%\texttt{\textbackslash{}chapter}, \texttt{\textbackslash{}section}, |
| 1176 |
%\texttt{\textbackslash{}subsection}, \texttt{subsubsection} and |
| 1177 |
%\texttt{\textbackslash{}paragraph} commands to add |
| 1178 |
%\texttt{\textbackslash{}pratendAddLabel} which will help the package to |
| 1179 |
%find the label of the current section. If you prefer the old behavior, |
| 1180 |
%you can disable it using the \texttt{disablePatchSection} option (more |
| 1181 |
%details in the package options). |
| 1182 |
% |
| 1183 |
%\subsection{\texorpdfstring{I get an error |
| 1184 |
%\texttt{ERROR:\ File\ ended\ while\ scanning\ use\ of\ \textbackslash{}@xverbatim.} |
| 1185 |
%when using verbatim inside a |
| 1186 |
%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} |
| 1187 |
% |
| 1188 |
%I turns out that this library needs to use the \texttt{+b} option of |
| 1189 |
%environments in order to manipulate appropriately the theorem/proof. |
| 1190 |
%Unfortunately, it means that it is not possible to use verbatim |
| 1191 |
%environments inside. While |
| 1192 |
%\href{https://tex.stackexchange.com/questions/489435/use-environment-into-new-xparse-environment}{this |
| 1193 |
%answer} suggests that it is impossible to avoid this issue, other people |
| 1194 |
%reported that it may be possible to use catcodes to capture the |
| 1195 |
%environment body verbatim, before using scantokens to reparse it, or to |
| 1196 |
%use |
| 1197 |
%\href{https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/filecontentsdef/filecontentsdef.pdf}{filecontentsdef} |
| 1198 |
%(see for instance |
| 1199 |
%\href{https://tex.stackexchange.com/questions/631810/create-a-newdocumentenvironment-programmatically?noredirect=1\#comment1575605_631810}{this |
| 1200 |
%comment}{]}, ). However, it may be possible that this make syntex |
| 1201 |
%unusable, so it may not worth the effort. |
| 1202 |
% |
| 1203 |
%In anycase, there exists some workarounds, some of the are for instance |
| 1204 |
%give in the \href{https://texfaq.org/FAQ-verbwithin}{TeX FAQ}. The |
| 1205 |
%simplest solution, if your code is simple/short enough, is to use |
| 1206 |
%\texttt{\textbackslash{}texttt} (you can replace backslash with |
| 1207 |
%\texttt{\textbackslash{}textbackslash} inside etc, and include it in a |
| 1208 |
%\texttt{verse} if you have multiple lines). If you have a longer text, |
| 1209 |
%you may also like \texttt{lrbox} to put your content inside a box, for |
| 1210 |
%instance like that: |
| 1211 |
% |
| 1212 |
%\begin{Shaded} |
| 1213 |
%\begin{Highlighting}[] |
| 1214 |
%\CommentTok{\%\% Create the box} |
| 1215 |
%\FunctionTok{\textbackslash{}newsavebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} |
| 1216 |
% |
| 1217 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} |
| 1218 |
% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}\{1.0}\FunctionTok{\textbackslash{}linewidth}\NormalTok{\}} |
| 1219 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}} |
| 1220 |
%\VerbatimStringTok{\textbackslash{}newEndThm[normal]\{thmE\}\{thm\}} |
| 1221 |
%\VerbatimStringTok{\textbackslash{}newEndProof\{proofE\}\{proof\}} |
| 1222 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{verbatim}\NormalTok{\}} |
| 1223 |
% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{minipage}\NormalTok{\}} |
| 1224 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{lrbox}\NormalTok{\}} |
| 1225 |
% |
| 1226 |
%\CommentTok{\%\% Create a theorem:} |
| 1227 |
%\KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 1228 |
%\NormalTok{ Insert the box:} |
| 1229 |
% |
| 1230 |
% \KeywordTok{\textbackslash{}begin}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}} |
| 1231 |
% \FunctionTok{\textbackslash{}usebox}\NormalTok{\{}\FunctionTok{\textbackslash{}myEndBox}\NormalTok{\}} |
| 1232 |
% \KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{center}\NormalTok{\}} |
| 1233 |
%\KeywordTok{\textbackslash{}end}\NormalTok{\{}\ExtensionTok{thmE}\NormalTok{\}} |
| 1234 |
%\end{Highlighting} |
| 1235 |
%\end{Shaded} |
| 1236 |
% |
| 1237 |
%\subsection{\texorpdfstring{The proof writes |
| 1238 |
%\texttt{Proof\ (Proof\ of\ Lemma\ X)} (or something else) instead of |
| 1239 |
%\texttt{Proof\ of\ Lemma\ X.}}{The proof writes Proof (Proof of Lemma X) (or something else) instead of Proof of Lemma X.}}\label{the-proof-writes-proof-proof-of-lemma-x-or-something-else-instead-of-proof-of-lemma-x.} |
| 1240 |
% |
| 1241 |
%If the proof starts with something different from |
| 1242 |
%\texttt{Proof\ of\ Lemma\ X}, you are likely to use a class/package that |
| 1243 |
%defines a \texttt{proof} environment different from the one defined in |
| 1244 |
%\texttt{amsthm}, like \texttt{svjour3} by Springer. To fix this, you |
| 1245 |
%have two options: if you want to keep using the original \texttt{proof} |
| 1246 |
%environment, and get something like \texttt{Proof\ (Lemma\ X)}, you can |
| 1247 |
%either configure: |
| 1248 |
% |
| 1249 |
%\begin{verbatim} |
| 1250 |
%\pratendSetGlobal{ |
| 1251 |
% text proof={\string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, |
| 1252 |
%} |
| 1253 |
%\end{verbatim} |
| 1254 |
% |
| 1255 |
%or, if you use a version greater than 2025/06/11 (included), you can |
| 1256 |
%simply call the \texttt{text\ proof\ only\ theorem}, either like in |
| 1257 |
%\texttt{\textbackslash{}pratendSetGlobal\{text\ proof\ only\ theorem\}} |
| 1258 |
%or directly when loading the package: |
| 1259 |
% |
| 1260 |
%\begin{verbatim} |
| 1261 |
%\usepackage[createShortEnv, conf={text proof only theorem}]{proof-at-the-end} |
| 1262 |
%\end{verbatim} |
| 1263 |
% |
| 1264 |
%Another option is to replace your class \texttt{proof} environment with, |
| 1265 |
%for instance, the one provided by \texttt{amsthm} like in: |
| 1266 |
% |
| 1267 |
%\begin{verbatim} |
| 1268 |
%% Removes the environment 'proof' defined by the class and replaces it with the one of amsthm: |
| 1269 |
%\let\proof\undefined |
| 1270 |
%\let\endproof\undefined |
| 1271 |
%\usepackage{amsthm} |
| 1272 |
%\end{verbatim} |
| 1273 |
% |
| 1274 |
%but ensure that \texttt{amsthm} does not produce additional conflicts. |
| 1275 |
%This method will write \texttt{Proof\ of\ Lemma\ X.} before starting the |
| 1276 |
%proof. |
| 1277 |
% |
| 1278 |
%\section{Changelog}\label{changelog} |
| 1279 |
% |
| 1280 |
%\begin{itemize} |
| 1281 |
%\tightlist |
| 1282 |
%\item |
| 1283 |
% 2026/01/12: Fix a bug that was not allowing stuff like |
| 1284 |
% \texttt{\textbackslash{}cite{[}foo{]}\{bar\}} in theorem titles by |
| 1285 |
% introducing an extra group around the title |
| 1286 |
%\item |
| 1287 |
% 2025/06/11: Add \texttt{text\ proof\ only\ theorem} |
| 1288 |
%\item |
| 1289 |
% 2022/02/07: |
| 1290 |
% |
| 1291 |
% \begin{enumerate} |
| 1292 |
% \def\labelenumi{\arabic{enumi}.} |
| 1293 |
% \tightlist |
| 1294 |
% \item |
| 1295 |
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue |
| 1296 |
% 2} was not really solved in fact\ldots{} Now, I use a more robust |
| 1297 |
% method to detect the current section: I write in an AUX file the |
| 1298 |
% label of the proof section. This way, I don't need anymore to use |
| 1299 |
% dirty tricks to recover the section label. |
| 1300 |
% \item |
| 1301 |
% Change the default text when the appendix is in an external file, |
| 1302 |
% and add options like \texttt{text\ link\ external\ appendix} to |
| 1303 |
% customize the text appearing when the appendix is in an external |
| 1304 |
% file. Of course, you can still change it using \texttt{text\ link} |
| 1305 |
% directly. |
| 1306 |
% \end{enumerate} |
| 1307 |
%\item |
| 1308 |
% 2022/02/04: |
| 1309 |
% |
| 1310 |
% \begin{enumerate} |
| 1311 |
% \def\labelenumi{\arabic{enumi}.} |
| 1312 |
% \tightlist |
| 1313 |
% \item |
| 1314 |
% Add a way to put theorems in different files. (see |
| 1315 |
% \texttt{external\ appendix}) |
| 1316 |
% \item |
| 1317 |
% Change the path for auxiliary files (should be transparent for the |
| 1318 |
% user) |
| 1319 |
% \item |
| 1320 |
% Add commands to change local/global configuration easily (see |
| 1321 |
% \texttt{\textbackslash{}pratendSetLocal},\texttt{\textbackslash{}pratendSetGlobal}) |
| 1322 |
% \end{enumerate} |
| 1323 |
%\item |
| 1324 |
% 2022/02/01: |
| 1325 |
% |
| 1326 |
% \begin{enumerate} |
| 1327 |
% \def\labelenumi{\arabic{enumi}.} |
| 1328 |
% \tightlist |
| 1329 |
% \item |
| 1330 |
% Fix a typo when defining the shortcut for lemma |
| 1331 |
% \item |
| 1332 |
% Add a shortcut for proposition |
| 1333 |
% \item |
| 1334 |
% Fix a small spacing issue in the text before the proof in Appendix |
| 1335 |
% \end{enumerate} |
| 1336 |
%\item |
| 1337 |
% 2022/01/28: |
| 1338 |
% |
| 1339 |
% \begin{enumerate} |
| 1340 |
% \def\labelenumi{\arabic{enumi}.} |
| 1341 |
% \tightlist |
| 1342 |
% \item |
| 1343 |
% Fix the issue when using sharps in a proof |
| 1344 |
% https://github.com/leo-colisson/proof-at-the-end/issues/7. |
| 1345 |
% \item |
| 1346 |
% Provide \texttt{\textbackslash{}newEndThm}, |
| 1347 |
% \texttt{\textbackslash{}newEndProof} and the option |
| 1348 |
% \texttt{createShortEnv} to quickly create environments. |
| 1349 |
% \end{enumerate} |
| 1350 |
%\item |
| 1351 |
% 2022/01/27: |
| 1352 |
% |
| 1353 |
% \begin{enumerate} |
| 1354 |
% \def\labelenumi{\arabic{enumi}.} |
| 1355 |
% \tightlist |
| 1356 |
% \item |
| 1357 |
% Patch chapters/sections/\ldots{} to better detect the current |
| 1358 |
% section and fix |
| 1359 |
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/2}{issue |
| 1360 |
% 2}. This can be disabled using the package option |
| 1361 |
% \texttt{disablePatchSection}. |
| 1362 |
% \item |
| 1363 |
% Add an option \texttt{commandRef} to use other ref libraries, like |
| 1364 |
% \texttt{cleveref} instead of \texttt{autoref}. |
| 1365 |
% \item |
| 1366 |
% Normal restatable theorem do not need to be restated. Fix |
| 1367 |
% \href{https://github.com/leo-colisson/proof-at-the-end/issues/8}{issue |
| 1368 |
% 8}. |
| 1369 |
% \end{enumerate} |
| 1370 |
%\end{itemize} |
| 1371 |
% |
| 1372 |
%\section{Contributions}\label{contributions} |
| 1373 |
% |
| 1374 |
%Feel free to contribute, report bugs, and send pull requests on the |
| 1375 |
%github repository \url{https://github.com/leo-colisson/proof-at-the-end} |
| 1376 |
%! |
| 1377 |
% |
| 1378 |
%NB: the documentation is generated from the Markdown file |
| 1379 |
%\texttt{README.md} thanks to pandoc. These commands may help you: |
| 1380 |
% |
| 1381 |
%\begin{Shaded} |
| 1382 |
%\begin{Highlighting}[] |
| 1383 |
%\ExtensionTok{\%\%}\NormalTok{ Compile the demo} |
| 1384 |
%\FunctionTok{make}\NormalTok{ demo} |
| 1385 |
%\ExtensionTok{\%\%}\NormalTok{ Clean the project} |
| 1386 |
%\FunctionTok{make}\NormalTok{ clean} |
| 1387 |
%\ExtensionTok{\%\%}\NormalTok{ Generate the documentation} |
| 1388 |
%\FunctionTok{make}\NormalTok{ doc} |
| 1389 |
%\ExtensionTok{\%\%}\NormalTok{ Generate a package for CTAN} |
| 1390 |
%\FunctionTok{make}\NormalTok{ package} |
| 1391 |
%\end{Highlighting} |
| 1392 |
%\end{Shaded} |
| 1393 |
% |
| 1394 |
% |
| 1395 |
% |
| 1396 |
% |
| 1397 |
%\StopEventually{} |
| 1398 |
%\section{The Code} |
| 1399 |
%\iffalse |
| 1400 |
% \begin{macrocode} |
| 1401 |
%<*proof-at-the-end.sty> |
| 1402 |
% \end{macrocode} |
| 1403 |
%\fi |
| 1404 |
\NeedsTeXFormat{LaTeX2e} |
| 1405 |
\ProvidesPackage{proof-at-the-end}[2026/01/12 A package to move proofs in appendix] |
| 1406 |
|
| 1407 |
\RequirePackage{etoolbox} |
| 1408 |
\RequirePackage{thmtools} |
| 1409 |
\RequirePackage{thm-restate} |
| 1410 |
\RequirePackage{catchfile} |
| 1411 |
\RequirePackage{pgfkeys} |
| 1412 |
\RequirePackage{xparse} |
| 1413 |
% Load hyperref at the end |
| 1414 |
\AtEndPreamble{% |
| 1415 |
\RequirePackage{hyperref} |
| 1416 |
}% |
| 1417 |
\RequirePackage{kvoptions} |
| 1418 |
|
| 1419 |
%% https://tex.stackexchange.com/questions/109747/put-all-package-options-into-one-command |
| 1420 |
%% Forward the options list to the command \pratendOptdefconf |
| 1421 |
%% in order to use: |
| 1422 |
%% \usepackage[conf={normal}]{proof-at-the-end} |
| 1423 |
\SetupKeyvalOptions{ |
| 1424 |
family=pratendOpt, |
| 1425 |
prefix=pratendOpt, % "Namespace": Prefix of the commands, conditions.... |
| 1426 |
} |
| 1427 |
\DeclareStringOption{conf} |
| 1428 |
\DeclareLocalOptions{conf}% \pratendOptdefconf contains the proof |
| 1429 |
\DeclareBoolOption{disablePatchSection} % Use \ifpratendOptdisablePatchSection ... \else ... \fi |
| 1430 |
\DeclareStringOption[autoref]{commandRef} % Use commandRef=cref to use cleveref. Defaults to autoref. |
| 1431 |
\DeclareBoolOption{createShortEnv} % To create thmE, theoremE, proofE, lemmaE, corrolaryE |
| 1432 |
\ProcessKeyvalOptions* |
| 1433 |
|
| 1434 |
% \DeclareOption*{\PackageWarning{proof-at-the-end}{Unknown}} |
| 1435 |
% \ProcessOptions\relax |
| 1436 |
|
| 1437 |
%% https://tex.stackexchange.com/a/13289/116348 |
| 1438 |
\newwrite\appendwrite |
| 1439 |
\newcount\pratend@count@makeallother |
| 1440 |
|
| 1441 |
%%% Loop to make sure all chars are normal letters, including #. |
| 1442 |
\newcommand{\makeallother}{% |
| 1443 |
\pratend@count@makeallother0\relax |
| 1444 |
\loop\ifnum\pratend@count@makeallother<255\relax |
| 1445 |
\catcode\pratend@count@makeallother12\relax |
| 1446 |
\advance\pratend@count@makeallother by 1\relax |
| 1447 |
\repeat |
| 1448 |
} |
| 1449 |
|
| 1450 |
%%% This command allows the user to append things to a file. But the content may contain macros that |
| 1451 |
%%% will be evaluated before writing them to the file. |
| 1452 |
%%% TODO: Efficiency may be improved by writing to the file only before the printProof. |
| 1453 |
% The first argument is the file name |
| 1454 |
% The second argument is the text to write |
| 1455 |
\NewDocumentCommand\appendtofile{m+m}{% |
| 1456 |
\begingroup |
| 1457 |
%% Read the content |
| 1458 |
\begingroup% |
| 1459 |
\IfFileExists{#1}{% |
| 1460 |
\newlinechar\endlinechar% |
| 1461 |
\makeallother% Turn all chars into normal letters. |
| 1462 |
\everyeof{\noexpand}% |
| 1463 |
\edef\fileContent{\@@input #1 }% |
| 1464 |
}{% |
| 1465 |
\let\fileContent\empty |
| 1466 |
}% |
| 1467 |
%% Open the file to write in it: |
| 1468 |
\immediate\openout\appendwrite #1\relax% |
| 1469 |
%% Write the text |
| 1470 |
\immediate\write\appendwrite{\fileContent}% |
| 1471 |
\endgroup% |
| 1472 |
\immediate\write\appendwrite{#2}% |
| 1473 |
%% Close the file |
| 1474 |
\immediate\closeout\appendwrite% |
| 1475 |
\endgroup |
| 1476 |
} |
| 1477 |
|
| 1478 |
%% Get the prefix of the file, given the jobname. |
| 1479 |
\NewDocumentCommand\pratendGeneratePrefixFile{m}{#1-pratend} |
| 1480 |
|
| 1481 |
\def\prefixPrAtEndFiles{\pratendGeneratePrefixFile{\jobname}} |
| 1482 |
|
| 1483 |
|
| 1484 |
%% This functions takes one input: the category (without .tex), |
| 1485 |
%% If it's the first time we write in this |
| 1486 |
%% category file, it "blanks" it. |
| 1487 |
|
| 1488 |
\newcommand*\eraseIfNeeded[1]{% |
| 1489 |
% A macro 'pratendmacrocat{category}' is created to check |
| 1490 |
% if it's the first time we write in this category file. |
| 1491 |
\protected@edef\macroname{pratendmacrocat#1}% |
| 1492 |
\ifcsdef{\macroname}{% The macro exists, nothing to do |
| 1493 |
}{ % The macro does not exists, create it, and empty the file |
| 1494 |
\global\expandafter\def\csname \macroname\endcsname{true}% |
| 1495 |
\immediate\openout\appendwrite=\prefixPrAtEndFiles#1.tex% |
| 1496 |
\immediate\write\appendwrite{}% |
| 1497 |
\immediate\closeout\appendwrite% |
| 1498 |
}% |
| 1499 |
} |
| 1500 |
|
| 1501 |
\newif\ifproofhere |
| 1502 |
\newif\ifproofend |
| 1503 |
\newif\ifrestatethm |
| 1504 |
\newif\ifexternalAppendix% True if the output file should me inputable in another file (using xr for crossref). Useful to remote restate. |
| 1505 |
\newif\iflinktoproof |
| 1506 |
\newif\ifboth |
| 1507 |
\newif\ifallattheend |
| 1508 |
\newif\ifrestatedbefore |
| 1509 |
\pgfkeys{ |
| 1510 |
/prAtEnd/.cd, %% Proof at end will be the main path |
| 1511 |
%% Category of the proof (if you want to put proofs |
| 1512 |
%% at several places), can be anything |
| 1513 |
category/.initial=defaultcategory, |
| 1514 |
category/.store in=\category, |
| 1515 |
category/.get=\category, |
| 1516 |
%% Display the proof in the main part |
| 1517 |
proof here/.is if=proofhere, |
| 1518 |
no proof here/.style={proof here=false}, % alias |
| 1519 |
%% Display the proof when using \printProofs |
| 1520 |
proof end/.is if=proofend, |
| 1521 |
no proof end/.style={proof end=false}, |
| 1522 |
%% Restate the theorem when using \printProofs |
| 1523 |
only external appendix/.is if=externalAppendix, |
| 1524 |
text link external appendix/.style={ |
| 1525 |
text link={The proof is in the appendix.} |
| 1526 |
}, |
| 1527 |
external appendix/.style={ |
| 1528 |
only external appendix, |
| 1529 |
text link external appendix, |
| 1530 |
}, |
| 1531 |
%% Restate the theorem when using \printProofs |
| 1532 |
restate/.is if=restatethm, |
| 1533 |
no restate/.style={restate=false}, |
| 1534 |
%% Put a link to the proof after the theorem |
| 1535 |
link to proof/.is if=linktoproof, |
| 1536 |
no link to proof/.style={link to proof=false}, |
| 1537 |
%% Put the theorem and proof only in appendix |
| 1538 |
opt all end/.is if=allattheend, |
| 1539 |
no opt all end/.style={opt all end=false}, |
| 1540 |
%% Text of link |
| 1541 |
text link/.code={\def\pratendtextlink{#1}}, |
| 1542 |
%% Text of proof. Make sure also to "\renewcommand*{\proofname}{Name of the proof}" |
| 1543 |
%% to make sure the proof for normal theorems are changed |
| 1544 |
text proof/.code={\def\pratendtextproof{#1}}, |
| 1545 |
%% Custom restate command |
| 1546 |
restate command/.code={\protected@edef\pratendcustomrestate{#1}}, |
| 1547 |
%% (Re)stated before |
| 1548 |
%% If the theorems has been stated before, then we just need to put the restate command in |
| 1549 |
%% place of the argument, and we set this value to true: |
| 1550 |
restated before/.is if=restatedbefore, |
| 1551 |
no restated before/.style={restated before=false}, |
| 1552 |
%% In star version, we don't want |
| 1553 |
%% Put the text (defined only for \textInAppendix) in both the |
| 1554 |
%% current location and in appendix |
| 1555 |
both/.is if=both, |
| 1556 |
no both/.style={both=false}, |
| 1557 |
%%%% Alias and styles |
| 1558 |
normal/.style={ |
| 1559 |
proof here, |
| 1560 |
no opt all end, |
| 1561 |
no proof end, |
| 1562 |
no link to proof, |
| 1563 |
no restate, |
| 1564 |
no both, |
| 1565 |
}, |
| 1566 |
proof at the end/.style={ |
| 1567 |
no proof here, |
| 1568 |
no opt all end, |
| 1569 |
proof end, |
| 1570 |
no both, |
| 1571 |
}, |
| 1572 |
end/.style={ |
| 1573 |
proof at the end, |
| 1574 |
link to proof, |
| 1575 |
}, |
| 1576 |
all end/.style={ |
| 1577 |
end, |
| 1578 |
opt all end, |
| 1579 |
}, |
| 1580 |
debug/.style={ |
| 1581 |
no opt all end, |
| 1582 |
proof here |
| 1583 |
}, |
| 1584 |
no link to theorem/.style={ % Remove the link to the theorem |
| 1585 |
text proof={\proofname}, |
| 1586 |
}, |
| 1587 |
stared/.style={ % Remove |
| 1588 |
text proof={\string\mbox{\string\hyperref[thm:prAtEnd\pratendcountercurrent]{\proofname}}}, |
| 1589 |
}, |
| 1590 |
no number/.style={ |
| 1591 |
stared |
| 1592 |
}, |
| 1593 |
see full proof/.style={ |
| 1594 |
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.} |
| 1595 |
}, |
| 1596 |
one big link/.style={ |
| 1597 |
text link={\hyperref[proof:prAtEnd\pratendcountercurrent] {#1}} |
| 1598 |
}, |
| 1599 |
one big link/.default={% |
| 1600 |
See proof on page~\pageref*{proof:prAtEnd\pratendcountercurrent}. |
| 1601 |
}, |
| 1602 |
one big link translated/.style={ |
| 1603 |
one big link={#1~\pageref*{proof:prAtEnd\pratendcountercurrent}.} |
| 1604 |
}, |
| 1605 |
text link section/.style={% |
| 1606 |
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} in \pratendSectionlikeCref.} |
| 1607 |
}, |
| 1608 |
text link section full proof/.style={% |
| 1609 |
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{full proof} in \pratendSectionlikeCref.} |
| 1610 |
}, |
| 1611 |
default text link/.style={ |
| 1612 |
text link={See \hyperref[proof:prAtEnd\pratendcountercurrent]{proof} on page~\pageref{proof:prAtEnd\pratendcountercurrent}.}, |
| 1613 |
}, |
| 1614 |
text proof translated/.style={ |
| 1615 |
text proof={#1 \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, |
| 1616 |
}, |
| 1617 |
default text proof/.style={ |
| 1618 |
text proof={Proof of \string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, |
| 1619 |
}, |
| 1620 |
text proof only theorem/.style={ |
| 1621 |
text proof={\string\pratendRef{thm:prAtEnd\pratendcountercurrent}}, |
| 1622 |
}, |
| 1623 |
%%%% Defaults |
| 1624 |
bare defaults/.style={ |
| 1625 |
end, |
| 1626 |
link to proof, |
| 1627 |
no restate, |
| 1628 |
category=defaultcategory, |
| 1629 |
default text link, |
| 1630 |
default text proof, |
| 1631 |
restate command=pratenddummymacro, |
| 1632 |
}, |
| 1633 |
configuration options/.style/.expand once={ |
| 1634 |
% This styles will contain the configuration |
| 1635 |
% given as options of the package like: |
| 1636 |
% \usepackage[conf={normal, no link to proof}]{proof-at-the-end} |
| 1637 |
% The package options does not accept macros and valued keys |
| 1638 |
% due to some fundamental issues: |
| 1639 |
% https://tex.stackexchange.com/questions/489564/use-unexpanded-macro-in-package-options/489570#489570 |
| 1640 |
% so if you need to write macro/valued key, edit instead the |
| 1641 |
% style "/prAtEnd/global custom defaults" or |
| 1642 |
% "local /prAtEnd/custom defaults" for local changes instead. |
| 1643 |
\pratendOptconf% |
| 1644 |
}, |
| 1645 |
global custom defaults/.style={ |
| 1646 |
%% you can put in this style any global defaults |
| 1647 |
%% that should overwrite the usual defaults. |
| 1648 |
}, |
| 1649 |
local custom defaults/.style={ |
| 1650 |
%% you can put in this style any overwrite of the defaults |
| 1651 |
%% that should be "local" and changed over the file, like |
| 1652 |
% the category for a given section. |
| 1653 |
}, |
| 1654 |
all defaults/.style={ |
| 1655 |
%% Load all the style that sets the default values |
| 1656 |
bare defaults, |
| 1657 |
configuration options, |
| 1658 |
global custom defaults, |
| 1659 |
local custom defaults, |
| 1660 |
}, |
| 1661 |
} |
| 1662 |
|
| 1663 |
\newcounter{counterAllProofEnd} |
| 1664 |
\stepcounter{counterAllProofEnd} |
| 1665 |
|
| 1666 |
\NewDocumentEnvironment{theoremEndRestateBefore}{mO{}m+b}{ |
| 1667 |
\stepcounter{counterAllProofEnd}% |
| 1668 |
\protected@edef\currcounterval{\roman{counterAllProofEnd}}% |
| 1669 |
\expandafter\protected@xdef\csname #3\endcsname{\currcounterval}% |
| 1670 |
\expanded{% |
| 1671 |
\noexpand\begin{restatable*}[{\unexpanded{#2}}]{\unexpanded{#1}}{prAtEndRestate\currcounterval}\noexpand\label{thm:prAtEnd\currcounterval}% |
| 1672 |
\unexpanded{#4}% |
| 1673 |
\noexpand\end{restatable*}% |
| 1674 |
}% |
| 1675 |
}{} |
| 1676 |
|
| 1677 |
\NewDocumentEnvironment{theoremEndOrig}{O{}mO{}+b}{ |
| 1678 |
% The first facultative argument will be the options: type of proof you want, the file to which you want to write... |
| 1679 |
% The first mandatory option is the type of the theorem (thm,lemma,...) |
| 1680 |
% The second facultative argument will be the title |
| 1681 |
% the second mandatory option is the theorem (will \label inside eventually) |
| 1682 |
% the last mandatory option is the proof, or, if restated, the name of the theorem. |
| 1683 |
\global\def\pratendlastoptions{#1}% |
| 1684 |
\pgfkeys{% |
| 1685 |
/prAtEnd/.cd, |
| 1686 |
all defaults, |
| 1687 |
#1 |
| 1688 |
}% |
| 1689 |
\stepcounter{counterAllProofEnd}% |
| 1690 |
%% Create the file if it's the first time |
| 1691 |
\eraseIfNeeded{\category}% |
| 1692 |
%% If the theorem must be written here: |
| 1693 |
\unless\ifallattheend% |
| 1694 |
%% Restate the theorem if it was stated before: |
| 1695 |
\ifrestatedbefore% |
| 1696 |
\protected@xdef\pratendcountercurrent{\csname #4\endcsname} % Store the current (alpha value of the) counter |
| 1697 |
\csname prAtEndRestate\pratendcountercurrent\endcsname % Restate the theorem |
| 1698 |
\fi% |
| 1699 |
%% Otherwise just state the theorem in a restatable environment |
| 1700 |
\unless\ifrestatedbefore% |
| 1701 |
\expanded{% This {} ----------V is needed to allow stuff like \cite[foo]{bar}. Test also with $\mathtt{G}$ |
| 1702 |
\noexpand\begin{restatable}[{\unexpanded{#3}}]{\unexpanded{#2}}{prAtEndRestate\roman{counterAllProofEnd}}% |
| 1703 |
\noexpand\label{thm:prAtEnd\roman{counterAllProofEnd}}% |
| 1704 |
\unexpanded{#4}% |
| 1705 |
\noexpand\end{restatable}% |
| 1706 |
}% |
| 1707 |
%% Store the current (alpha value of the) counter |
| 1708 |
%% in \pratendcountercurrent |
| 1709 |
\protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} % |
| 1710 |
\fi% |
| 1711 |
%% Create a custom alias to restate the theorem |
| 1712 |
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}% |
| 1713 |
%% Restate the theorem if needed in appendix. |
| 1714 |
%% As explained in https://github.com/leo-colisson/proof-at-the-end/issues/8 |
| 1715 |
%% No need to restate of there is no proof at the end. |
| 1716 |
\ifproofend% |
| 1717 |
\ifrestatethm% |
| 1718 |
\ifexternalAppendix% We write the full theorem, useful to compile in a separate file (use xr for references) |
| 1719 |
\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}% |
| 1720 |
\else% |
| 1721 |
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\prAtEndRestate\pratendcountercurrent*}% |
| 1722 |
\fi% |
| 1723 |
\fi% |
| 1724 |
\fi% |
| 1725 |
\fi% |
| 1726 |
%% If the theorem is not stated in the main text, |
| 1727 |
%% write it at the end |
| 1728 |
\ifallattheend% |
| 1729 |
%% Store the current (alpha value of the) counter |
| 1730 |
%% in \pratendcountercurrent |
| 1731 |
\protected@xdef\pratendcountercurrent{\roman{counterAllProofEnd}} |
| 1732 |
%% Create a custom alias to restate the theorem |
| 1733 |
\expandafter\protected@xdef\csname \pratendcustomrestate\endcsname{\noexpand\csname prAtEndRestate\pratendcountercurrent\endcsname}% |
| 1734 |
\appendtofile{\prefixPrAtEndFiles\category.tex}{\string\begin{restatable}[\detokenize{#3}]{#2}{prAtEndRestate\pratendcountercurrent}\string\label{thm:prAtEnd\pratendcountercurrent}\detokenize{#4}\string\end{restatable}}% |
| 1735 |
\fi% |
| 1736 |
}{} |
| 1737 |
|
| 1738 |
|
| 1739 |
%% See proofEnableDebugSynctex |
| 1740 |
%%% WARNING: if you change this function, change also proofDisableDebugSynctex |
| 1741 |
\NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% |
| 1742 |
\begin{theoremEndOrig}[#1]{#2}[#3] |
| 1743 |
#4% |
| 1744 |
\end{theoremEndOrig}% |
| 1745 |
}{} |
| 1746 |
|
| 1747 |
\NewDocumentEnvironment{proofEndOrig}{O{}+b}{% |
| 1748 |
\pgfkeys{% |
| 1749 |
/prAtEnd/.cd, |
| 1750 |
all defaults, |
| 1751 |
prAtEndTmpStyle/.style/.expand once={\pratendlastoptions}, |
| 1752 |
prAtEndTmpStyle, |
| 1753 |
#1 |
| 1754 |
}% |
| 1755 |
\unless\ifallattheend% |
| 1756 |
%% Write eventually a link to the proof |
| 1757 |
\iflinktoproof% |
| 1758 |
\pratendtextlink{}% |
| 1759 |
\fi% |
| 1760 |
%% And eventually the proof |
| 1761 |
\ifproofhere% |
| 1762 |
\begin{proof}% |
| 1763 |
#2% |
| 1764 |
\end{proof}% |
| 1765 |
\fi% |
| 1766 |
\fi% |
| 1767 |
%% Write the proof at the end |
| 1768 |
\ifproofend% |
| 1769 |
\appendtofile{\prefixPrAtEndFiles\category.tex}{% |
| 1770 |
%% The label alone adds some space, see e.g. |
| 1771 |
%% https://tex.stackexchange.com/questions/600118/selectlanguage-in-the-middle-of-text-causes-extra-vertical-space/600142#600142 |
| 1772 |
%% and https://tex.stackexchange.com/questions/600577/adding-a-label-between-two-proofs-adds-unwanted-space |
| 1773 |
%% The solution is to use \\Hy@SaveLastskip and \Hy@RestoreLastskip from hyperref |
| 1774 |
%% See also |
| 1775 |
%% https://tex.stackexchange.com/questions/553394/reliably-add-a-label-to-the-current-section-even-if-the-label-is-not-placed-rig/600847#600847 |
| 1776 |
\string\makeatletter\string\Hy@SaveLastskip% |
| 1777 |
%% 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 |
| 1778 |
%% as cref is not using it apparently, and it turns Appendix A into appendix a after using phantomsection. |
| 1779 |
%% https://github.com/leo-colisson/proof-at-the-end/issues/2 |
| 1780 |
\string\label{proofsection:prAtEnd\pratendcountercurrent}% WARNING <-- do not use this label in new documents! |
| 1781 |
% the problem is that setting the \@currentlabel does not work for cref, and turns Appendix A |
| 1782 |
% into section A when a phantomsection lies in between (not sure why): |
| 1783 |
% https://github.com/leo-colisson/proof-at-the-end/issues/2 |
| 1784 |
%% Now, we prefer a different method: instead we generate a single label per section, and we generate |
| 1785 |
%% a new macro in the aux file that will save this label, by creating one such macro per theorem. |
| 1786 |
%% This is basically doing something like \pratend@section@for@proofiii{prAtEnd:sectionlike3} |
| 1787 |
%% Note that I need sometimes 3 \string because I write two times: the first time I write in the FILE-pratendCATEGORY.tex |
| 1788 |
%% file, and this file will be in charge of writting into the .aux file. |
| 1789 |
\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. |
| 1790 |
\string\immediate\string\write\string\@auxout{% |
| 1791 |
\string\string\string\gdef\string\string\string\pratend@section@for@proof\pratendcountercurrent{\string\pratend@current@sectionlike@label}% |
| 1792 |
}% |
| 1793 |
\string\fi |
| 1794 |
% See above |
| 1795 |
\string\Hy@RestoreLastskip\string\makeatother% |
| 1796 |
% We start the proof |
| 1797 |
\string\begin{proof}[\pratendtextproof]% |
| 1798 |
% We add a label to have a reference to the section |
| 1799 |
\string\phantomsection\string\label{proof:prAtEnd\pratendcountercurrent}% |
| 1800 |
% We add the proof |
| 1801 |
\detokenize{#2}% |
| 1802 |
% We end the proof |
| 1803 |
\string\end{proof}}% |
| 1804 |
\fi% |
| 1805 |
}{} |
| 1806 |
|
| 1807 |
%%% WARNING: if you change this function, change also proofDisableDebugSynctex |
| 1808 |
\NewDocumentEnvironment{proofEnd}{O{}+b}{% |
| 1809 |
\begin{proofEndOrig}[#1]% |
| 1810 |
#2 |
| 1811 |
\end{proofEndOrig}% |
| 1812 |
}{} |
| 1813 |
|
| 1814 |
|
| 1815 |
%%%%% For synctex debugging |
| 1816 |
%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 |
| 1817 |
\NewDocumentCommand{\pratendEnableDebugSynctex}{}{% |
| 1818 |
\RenewDocumentEnvironment{theoremEnd}{O{}mO{}}{\begin{##2}}{\end{##2}} |
| 1819 |
\RenewDocumentEnvironment{proofEnd}{O{}}{\begin{proof}}{\end{proof}} |
| 1820 |
} |
| 1821 |
|
| 1822 |
%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 |
| 1823 |
\NewDocumentCommand{\pratendDisableDebugSynctex}{}{% |
| 1824 |
\RenewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% |
| 1825 |
\begin{theoremEndOrig}[##1]{##2}[##3]% |
| 1826 |
##4% |
| 1827 |
\end{theoremEndOrig}% |
| 1828 |
}{}% |
| 1829 |
\RenewDocumentEnvironment{proofEnd}{O{}+b}{% |
| 1830 |
\begin{proofEndOrig}[##1]% |
| 1831 |
##2% |
| 1832 |
\end{proofEndOrig}% |
| 1833 |
}{} |
| 1834 |
} |
| 1835 |
|
| 1836 |
\NewDocumentEnvironment{proofEndDebug}{O{}}{% |
| 1837 |
\begin{proof}% |
| 1838 |
}{% |
| 1839 |
\end{proof}% |
| 1840 |
} |
| 1841 |
\NewDocumentEnvironment{theoremEndDebug}{O{}mO{}}{\begin{#2}}{\end{#2}} |
| 1842 |
|
| 1843 |
|
| 1844 |
%%%%% Text in appendix |
| 1845 |
|
| 1846 |
\NewDocumentEnvironment{textAtEnd}{O{}+b}{ |
| 1847 |
% Use it to put normal text in Appendix. |
| 1848 |
\pgfkeys{ |
| 1849 |
/prAtEnd/.cd, |
| 1850 |
all defaults, |
| 1851 |
#1 |
| 1852 |
}% |
| 1853 |
\ifboth% |
| 1854 |
#2% |
| 1855 |
\fi% |
| 1856 |
\eraseIfNeeded{\category}% |
| 1857 |
\appendtofile{\prefixPrAtEndFiles\category.tex}{\detokenize{#2}}% |
| 1858 |
}{} |
| 1859 |
|
| 1860 |
\NewDocumentCommand\textEnd{O{}+m}{% |
| 1861 |
\begin{textAtEnd}[#1]% |
| 1862 |
#2% |
| 1863 |
\end{textAtEnd}% |
| 1864 |
} |
| 1865 |
|
| 1866 |
\NewDocumentCommand\printProofs{O{defaultcategory}}{ |
| 1867 |
\input{\prefixPrAtEndFiles#1.tex} |
| 1868 |
} |
| 1869 |
|
| 1870 |
|
| 1871 |
%%% You can easily modify the defaults: |
| 1872 |
% \pgfkeys{/prAtEnd/custom defaults/.style={ |
| 1873 |
% category=greattheorem |
| 1874 |
% } |
| 1875 |
% } |
| 1876 |
%%% Or create new styles to apply: |
| 1877 |
% \pgfkeys{/prAtEnd/great category/.style={ |
| 1878 |
% category=greattheorem |
| 1879 |
% } |
| 1880 |
% } |
| 1881 |
|
| 1882 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1883 |
%%% Patch sections, chapters... |
| 1884 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1885 |
% We patch the \section, \subsection and \chapter commands to make sure that |
| 1886 |
% the text "See proof in Section XX" points to the appropriate section/subsection (option conf={text link section}). |
| 1887 |
% We basically maintain a counter counting how many times we saw a section/subsection/... and use it to label |
| 1888 |
% directly the section afterwards. |
| 1889 |
\newcounter{pratend@counter@sectionlike} |
| 1890 |
%% Command to add after a label like "prAtEnd:sectionlike10". Useful to patch \section, \chapter... |
| 1891 |
\NewDocumentCommand\pratendAddLabel{}{% |
| 1892 |
%% First, we get the label |
| 1893 |
%% Cool explaination of expandafter, edef, noexpand: |
| 1894 |
%%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf |
| 1895 |
%% The label \pratend@current@sectionlike@label is used later. |
| 1896 |
\xdef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% |
| 1897 |
\expandafter\label{\pratend@current@sectionlike@label}% |
| 1898 |
\stepcounter{pratend@counter@sectionlike}% |
| 1899 |
}% |
| 1900 |
%% Returns the label of the section (in appendix) that contains the proof of the current theorem. |
| 1901 |
%% The first time, it will return an empty label. |
| 1902 |
\NewDocumentCommand\pratendLabelProofSection{}{% |
| 1903 |
\ifcsname pratend@section@for@proof\pratendcountercurrent\endcsname% |
| 1904 |
\csname pratend@section@for@proof\pratendcountercurrent\endcsname% |
| 1905 |
\fi% |
| 1906 |
}% |
| 1907 |
\NewDocumentCommand\pratendSectionlikeCref{}{% |
| 1908 |
% \pratendRef{proofsection:prAtEnd\pratendcountercurrent}% This is not robust enough. Lets change strategy. |
| 1909 |
\expandafter\pratendRef{\pratendLabelProofSection}% |
| 1910 |
} |
| 1911 |
\ifpratendOptdisablePatchSection% |
| 1912 |
\else % |
| 1913 |
%% Add the command \pratendAddLabel to \chapter/sections… if the command exists |
| 1914 |
%% KOMA class need a special treatment |
| 1915 |
\@ifundefined{KOMAClassName}{% |
| 1916 |
% For articles/... |
| 1917 |
\ifdef{\@chapter}{ |
| 1918 |
\ifpatchable*{\@chapter}{ |
| 1919 |
\apptocmd{\@chapter}{\pratendAddLabel}{}{}% |
| 1920 |
}{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}} |
| 1921 |
}{} |
| 1922 |
%% patch sections/subsections/paragraph/... |
| 1923 |
%% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717 |
| 1924 |
\ifdef{\@sect}{ |
| 1925 |
% \apptocmd{\section}{\pratendAddLabel}{}{}% |
| 1926 |
\ifpatchable*{\@sect}{ |
| 1927 |
\apptocmd{\@sect}{\pratendAddLabel}{}{}% |
| 1928 |
}{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}} |
| 1929 |
}{}% |
| 1930 |
}{% |
| 1931 |
%% For KOMA classes/... or it won't work with scrreport |
| 1932 |
%% \AddtoDoHook{heading/endgroup/chapter} is too specific |
| 1933 |
\AddtoDoHook{heading/endgroup/chapter}{\pratendAddLabel}% |
| 1934 |
\AddtoDoHook{heading/endgroup/section}{\pratendAddLabel}% |
| 1935 |
}% |
| 1936 |
\fi |
| 1937 |
|
| 1938 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1939 |
%%% Allow cref/autoref/... |
| 1940 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1941 |
%% Instead of \autoref{proof:blabla} use \pratendRef{proof:blabla}, it allows the ref command to be customized |
| 1942 |
%% as an option of the package. |
| 1943 |
\NewDocumentCommand\pratendRef{m}{% |
| 1944 |
\csname \pratendOptcommandRef\endcsname{#1}% |
| 1945 |
} |
| 1946 |
|
| 1947 |
|
| 1948 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1949 |
%%% Create automatically wrapper |
| 1950 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1951 |
|
| 1952 |
%% Defines a shortcut to avoid typing the whole theoremEnd environment. |
| 1953 |
%% Avoid to manually type \NewDocumentEnvironment... |
| 1954 |
%% Usage: \newEndThm[default options]{new environment}{old environment} |
| 1955 |
% E.g.: \newEndThm[normal]{thmE}{thm}{} |
| 1956 |
\NewDocumentCommand{\newEndThm}{O{}mm}{% |
| 1957 |
% \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% |
| 1958 |
% \begin{theoremEnd}[#1,##2]{#3}[##1]% |
| 1959 |
% ##3% |
| 1960 |
% \end{theoremEnd}% |
| 1961 |
% }{} |
| 1962 |
\NewDocumentEnvironment{#2}{O{}O{}}{% |
| 1963 |
\begin{theoremEnd}[#1,##2]{#3}[##1]% |
| 1964 |
}{\end{theoremEnd}}% |
| 1965 |
\NewDocumentEnvironment{#2D}{O{}O{}}{% |
| 1966 |
\bgroup% |
| 1967 |
\pratendEnableDebugSynctex{}% |
| 1968 |
\begin{theoremEnd}[#1,##2]{#3}[##1]% |
| 1969 |
}{\end{theoremEnd}% |
| 1970 |
\egroup% |
| 1971 |
}% |
| 1972 |
} |
| 1973 |
|
| 1974 |
% \NewDocumentCommand{\newEndThm}{O{}mm}{% |
| 1975 |
% % \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% |
| 1976 |
% % \begin{theoremEnd}[#1,##2]{#3}[##1]% |
| 1977 |
% % ##3% |
| 1978 |
% % \end{theoremEnd}% |
| 1979 |
% % }{} |
| 1980 |
% \expandafter\NewDocumentEnvironment{#2}{O{}O{}+b}{% |
| 1981 |
% \begin{theoremEnd}[#1,##2]{#3}[##1]% |
| 1982 |
% ##3 |
| 1983 |
% \end{theoremEnd}% |
| 1984 |
% }{} |
| 1985 |
% } |
| 1986 |
|
| 1987 |
%% Avoid to manually type \NewDocumentEnvironment... |
| 1988 |
%% Usage: \newEndProof[default options]{new proof environment}{old proof environment} |
| 1989 |
% E.g.: \newEndProof[]{proofE}{proof} |
| 1990 |
\NewDocumentCommand{\newEndProof}{O{}m}{% |
| 1991 |
\NewDocumentEnvironment{#2}{O{}+b}{% |
| 1992 |
\begin{proofEnd}[#1,##1]% |
| 1993 |
##2% |
| 1994 |
\end{proofEnd}% |
| 1995 |
}{}% |
| 1996 |
\NewDocumentEnvironment{#2D}{O{}}{% |
| 1997 |
\begin{proofEndDebug}[##1]% |
| 1998 |
}{% |
| 1999 |
\end{proofEndDebug}% |
| 2000 |
}% |
| 2001 |
} |
| 2002 |
|
| 2003 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2004 |
%%% Create even more automatically wrapper with option "createShortEnv" |
| 2005 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2006 |
\ifpratendOptcreateShortEnv |
| 2007 |
%%% We create automatically the environments. |
| 2008 |
\newEndProof{proofE} |
| 2009 |
\newEndThm{thmE}{thm} |
| 2010 |
\newEndThm{lemmaE}{lemma} |
| 2011 |
\newEndThm{theoremE}{theorem} |
| 2012 |
\newEndThm{corollaryE}{corollary} |
| 2013 |
\newEndThm{propositionE}{proposition} |
| 2014 |
\newEndThm{propertyE}{proposition} |
| 2015 |
\newEndThm{factE}{proposition} |
| 2016 |
\fi |
| 2017 |
|
| 2018 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2019 |
%%% Create functions to easily overwrite defaults |
| 2020 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2021 |
|
| 2022 |
\NewDocumentCommand\pratendSetGlobal{m}{% |
| 2023 |
\pgfkeys{/prAtEnd/global custom defaults/.style={ |
| 2024 |
#1 |
| 2025 |
}% |
| 2026 |
}% |
| 2027 |
} |
| 2028 |
|
| 2029 |
\NewDocumentCommand\pratendSetLocal{m}{% |
| 2030 |
\pgfkeys{/prAtEnd/local custom defaults/.style={ |
| 2031 |
#1 |
| 2032 |
}% |
| 2033 |
}% |
| 2034 |
} |
| 2035 |
|
| 2036 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2037 |
%%% Create functions to load the category file in another file (external bibliography) |
| 2038 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2039 |
|
| 2040 |
% Takes an optional category, and the job name of the external file. |
| 2041 |
\NewDocumentCommand\includeExternalAppendix{O{defaultcategory}m}{% |
| 2042 |
\expandafter\input{\pratendGeneratePrefixFile{#2}#1} |
| 2043 |
} |
| 2044 |
|
| 2045 |
\endinput |
| 2046 |
%\iffalse |
| 2047 |
% \begin{macrocode} |
| 2048 |
%</proof-at-the-end.sty> |
| 2049 |
% \end{macrocode} |
| 2050 |
%\fi |
| 2051 |
%\Finale |
| 2052 |
\endinput |