diff options
author | Norbert Preining <norbert@preining.info> | 2022-08-25 03:01:33 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-08-25 03:01:33 +0000 |
commit | 38aaa5ab119dae8bf21971e84c7742b2bfc591a5 (patch) | |
tree | 65cf0c27b647f48c2a53e8f00d1c379008701e87 /macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx | |
parent | 2fcb60fa8843870d9f3a90987498e5b775402258 (diff) |
CTAN sync 202208250301
Diffstat (limited to 'macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx')
-rw-r--r-- | macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx | 130 |
1 files changed, 100 insertions, 30 deletions
diff --git a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx index 8fee5c8ecd..06688d590c 100644 --- a/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx +++ b/macros/latex/contrib/proof-at-the-end/proof-at-the-end.dtx @@ -1,12 +1,12 @@ %\iffalse % proof-at-the-end.dtx generated using makedtx version 1.2 (c) Nicola Talbot % Command line args: +% -author "Léo Colisson" % -doc "../doc/proof-at-the-end_doc.tex" % -src "proof-at-the-end\.sty=>proof-at-the-end.sty" -% -author "Léo Colisson" -% -dir "/home/leo/Documents/Informatique/Programmation/LaTeX/proof-at-the-end/" +% -dir "/tmp/proof-at-the-end/" % proof-at-the-end -% Created on 2022/2/7 18:01 +% Created on 2022/8/24 17:25 %\fi %\iffalse %<*package> @@ -39,10 +39,6 @@ % \documentclass[ ]{article} -\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX} -\author{Léo Colisson} -\date{} - \usepackage{amsmath,amssymb} \usepackage{lmodern} \usepackage{iftex} @@ -80,6 +76,7 @@ hidelinks, pdfcreator={LaTeX via pandoc}} \urlstyle{same} % disable monospaced font for URLs +\usepackage[margin=1in]{geometry} \usepackage{color} \usepackage{fancyvrb} \newcommand{\VerbBar}{|} @@ -139,6 +136,10 @@ \usepackage{selnolig} % disable illegal ligatures \fi +\title{Proof-at-the-end, or how to move proofs in appendix in LaTeX} +\author{Léo Colisson} +\date{} + \begin{document} \DocInput{proof-at-the-end.dtx} \end{document} @@ -206,7 +207,7 @@ %Disclaimer: This package is still in beta and not considered as stable. % %This package is licensed under LPPL v1.3, and the last version of this -%package on CTAN is 2019/05/21. +%package on CTAN is 2022/08/24. % %\hypertarget{demo}{% %\section{Demo}\label{demo}} @@ -1239,6 +1240,9 @@ %\begin{itemize} %\tightlist %\item +% 2022/08/24: Fix the issues on KOMA classes +% https://github.com/leo-colisson/proof-at-the-end/issues/11 +%\item % 2022/02/07: % % \begin{enumerate} @@ -1356,7 +1360,7 @@ % \end{macrocode} %\fi \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{proof-at-the-end}[2022/02/07 A package to move proofs in appendix] +\ProvidesPackage{proof-at-the-end}[2022/08/24 A package to move proofs in appendix] \RequirePackage{etoolbox} \RequirePackage{thmtools} @@ -1624,7 +1628,7 @@ \end{restatable*}% }{} -\NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{ +\NewDocumentEnvironment{theoremEndOrig}{O{}mO{}+b}{ % The first facultative argument will be the options: type of proof you want, the file to which you want to write... % The first mandatory option is the type of the theorem (thm,lemma,...) % The second facultative argument will be the title @@ -1686,7 +1690,16 @@ \fi% }{} -\NewDocumentEnvironment{proofEnd}{O{}+b}{ + +%% See proofEnableDebugSynctex +%%% WARNING: if you change this function, change also proofDisableDebugSynctex +\NewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% + \begin{theoremEndOrig}[#1]{#2}[#3] + #4% + \end{theoremEndOrig}% +}{} + +\NewDocumentEnvironment{proofEndOrig}{O{}+b}{ \pgfkeys{% /prAtEnd/.cd, all defaults, @@ -1746,6 +1759,42 @@ \fi% }{} +%%% WARNING: if you change this function, change also proofDisableDebugSynctex +\NewDocumentEnvironment{proofEnd}{O{}+b}{% + \begin{proofEndOrig}[#1]% + #2 + \end{proofEndOrig}% +}{} + + +%%%%% For synctex debugging +%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 +\NewDocumentCommand{\pratendEnableDebugSynctex}{}{% + \RenewDocumentEnvironment{theoremEnd}{O{}mO{}}{\begin{##2}}{\end{##2}} + \RenewDocumentEnvironment{proofEnd}{O{}}{\begin{proof}}{\end{proof}} +} + +%% Turns https://github.com/leo-colisson/proof-at-the-end/issues/10 +\NewDocumentCommand{\pratendDisableDebugSynctex}{}{% + \RenewDocumentEnvironment{theoremEnd}{O{}mO{}+b}{% + \begin{theoremEndOrig}[##1]{##2}[##3]% + ##4% + \end{theoremEndOrig}% + }{}% + \RenewDocumentEnvironment{proofEnd}{O{}+b}{% + \begin{proofEndOrig}[##1]% + ##2% + \end{proofEndOrig}% + }{} +} + +\NewDocumentEnvironment{proofEndDebug}{O{}}{% + \begin{proof}% + }{% + \end{proof}% +} +\NewDocumentEnvironment{theoremEndDebug}{O{}mO{}}{\begin{#2}}{\end{#2}} + %%%%% Text in appendix @@ -1789,7 +1838,7 @@ %%% Patch sections, chapters... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We patch the \section, \subsection and \chapter commands to make sure that -% the text "See proof in Section XX" points to the appropriate section/subsection. +% the text "See proof in Section XX" points to the appropriate section/subsection (option conf={text link section}). % We basically maintain a counter counting how many times we saw a section/subsection/... and use it to label % directly the section afterwards. \newcounter{pratend@counter@sectionlike} @@ -1799,7 +1848,7 @@ %% Cool explaination of expandafter, edef, noexpand: %%% https://www.tug.org/TUGboat/tb09-1/tb20bechtolsheim.pdf %% The label \pratend@current@sectionlike@label is used later. - \edef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% + \xdef\pratend@current@sectionlike@label{prAtEnd:sectionlike\thepratend@counter@sectionlike}% \expandafter\label{\pratend@current@sectionlike@label}% \stepcounter{pratend@counter@sectionlike}% }% @@ -1816,20 +1865,29 @@ } \ifpratendOptdisablePatchSection% \else % - %% Add the above command to \chapter if the command exists - \ifdef{\@chapter}{ - \ifpatchable*{\@chapter}{ - \apptocmd{\@chapter}{\pratendAddLabel}{}{}% - }{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}} - }{} - %% patch sections/subsections/paragraph/... - %% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717 - \ifdef{\@sect}{ - % \apptocmd{\section}{\pratendAddLabel}{}{}% - \ifpatchable*{\@sect}{ - \apptocmd{\@sect}{\pratendAddLabel}{}{}% - }{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}} - }{} + %% Add the command \pratendAddLabel to \chapter/sections… if the command exists + %% KOMA class need a special treatment + \@ifundefined{KOMAClassName}{% + % For articles/... + \ifdef{\@chapter}{ + \ifpatchable*{\@chapter}{ + \apptocmd{\@chapter}{\pratendAddLabel}{}{}% + }{\PackageWarning{proof-at-the-end}{Chapters are not patchable.}{}} + }{} + %% patch sections/subsections/paragraph/... + %% https://tex.stackexchange.com/questions/631713/patch-section-command-fails/631717?noredirect=1#comment1575337_631717 + \ifdef{\@sect}{ + % \apptocmd{\section}{\pratendAddLabel}{}{}% + \ifpatchable*{\@sect}{ + \apptocmd{\@sect}{\pratendAddLabel}{}{}% + }{\PackageWarning{proof-at-the-end}{Sections are not patchable.}{}} + }{}% + }{% + %% For KOMA classes/... or it won't work with scrreport + %% \AddtoDoHook{heading/endgroup/chapter} is too specific + \AddtoDoHook{heading/endgroup/chapter}{\pratendAddLabel}% + \AddtoDoHook{heading/endgroup/section}{\pratendAddLabel}% + }% \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1859,6 +1917,13 @@ \NewDocumentEnvironment{#2}{O{}O{}}{% \begin{theoremEnd}[#1,##2]{#3}[##1]% }{\end{theoremEnd}}% + \NewDocumentEnvironment{#2D}{O{}O{}}{% + \bgroup% + \pratendEnableDebugSynctex{}% + \begin{theoremEnd}[#1,##2]{#3}[##1]% + }{\end{theoremEnd}% + \egroup% + }% } % \NewDocumentCommand{\newEndThm}{O{}mm}{% @@ -1874,15 +1939,20 @@ % }{} % } -%% Avoid to manually type \NewDocumentEnvironment... -%% Usage: \newEndProof[default options]{new proof environment}{old proof environment} -% E.g.: \newEndProof[]{proofE}{proof} +%% Avoid to manually type \NewDocumentEnvironment... +%% Usage: \newEndProof[default options]{new proof environment}{old proof environment} +% E.g.: \newEndProof[]{proofE}{proof} \NewDocumentCommand{\newEndProof}{O{}m}{% \NewDocumentEnvironment{#2}{O{}+b}{% \begin{proofEnd}[#1,##1]% ##2% \end{proofEnd}% }{}% + \NewDocumentEnvironment{#2D}{O{}}{% + \begin{proofEndDebug}[##1]% + }{% + \end{proofEndDebug}% + }% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |