summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/apxproof/apxproof.sty')
-rw-r--r--Master/texmf-dist/tex/latex/apxproof/apxproof.sty169
1 files changed, 131 insertions, 38 deletions
diff --git a/Master/texmf-dist/tex/latex/apxproof/apxproof.sty b/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
index 1ca283ae346..5371853fc93 100644
--- a/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
+++ b/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
@@ -27,7 +27,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{apxproof}
- [2018/05/10 v1.0.6 Automatic proofs in appendix]
+ [2018/08/08 v1.1.0 Automatic proofs in appendix]
\RequirePackage{bibunits}
\RequirePackage{environ}
\RequirePackage{etoolbox}
@@ -53,6 +53,7 @@
}
\DeclareStringOption[append]{appendix}
\DeclareStringOption[separate]{bibliography}
+\DeclareStringOption[same]{repeqn}
\ProcessLocalKeyvalOptions*
\ifthenelse{\equal{\axp@appendix}{append}}{
\message{apxproof: Appendix material appended to the document}
@@ -61,7 +62,7 @@
}{\ifthenelse{\equal{\axp@appendix}{inline}}{
\message{apxproof: Appendix material inlined within the document}
}{
- \errmessage{Error: unsupported option appendix=\axp@appendix for
+ \errmessage{Error: unsupported option appendix=\axp@appendix\ for
package apxproof}
}}}
\ifthenelse{\equal{\axp@bibliography}{separate}}{
@@ -69,7 +70,15 @@
}{\ifthenelse{\equal{\axp@bibliography}{common}}{
\message{apxproof: Common bibliography for appendix and main text}
}{
- \errmessage{Error: unsupported option bibliography=\axp@bibliography for
+ \errmessage{Error: unsupported option bibliography=\axp@bibliography\ for
+ package apxproof}
+}}
+\ifthenelse{\equal{\axp@repeqn}{same}}{
+ \message{apxproof: Repeated equations keep the same numbering}
+}{\ifthenelse{\equal{\axp@repeqn}{independent}}{
+ \message{apxproof: Repeated equations are independently numbered}
+}{
+ \errmessage{Error: unsupported option repeqn=\axp@repeqn\ for
package apxproof}
}}
\def\axp@newtheorem{\@ifstar\@@axp@newtheorem\@axp@newtheorem}
@@ -99,9 +108,29 @@
\newcommand{\appendixbibliographystyle}{alpha}
\newcommand{\appendixbibliographyprelim}{}
\newcommand{\appendixprelim}{\clearpage\onecolumn}
-\newcommand{\appendixsectionformat}[2]{Proofs for Section~#1 (#2)}
+\newcommand{\appendixsectionformat}[2]{Proofs for Section~#1\ (#2)}
\let\axp@oldproof\proof
\let\endaxp@oldproof\endproof
+ \newcommand{\axp@redefinelabels}{%
+ \providecommand\label@in@display{}
+ \ifthenelse{\equal{\axp@appendix}{inline}}{
+ \let\axp@oldlabel\label
+ \let\axp@oldlabel@in@display\label@in@display
+ \renewcommand\label[1]{%
+ \axp@oldlabel{##1}%
+ \axp@oldlabel{##1-apx}%
+ }%
+ \renewcommand\label@in@display[1]{%
+ \axp@oldlabel@in@display{##1}%
+ \axp@oldlabel{##1-apx}%
+ }%
+ }{%
+ \let\axp@oldlabel\label
+ \let\axp@oldlabel@in@display\label@in@display
+ \renewcommand\label[1]{\axp@oldlabel{##1-apx}}%
+ \renewcommand\label@in@display[1]{\axp@oldlabel@in@display{##1-apx}}%
+ }%
+ }
\ifdefined\spnewtheorem
\def\@axp@newtheorem#1#2#3#4{%
\ifx\relax#4\relax
@@ -129,7 +158,7 @@
\expandafter\let\csname c@#1\endcsname\undefined
\axp@newtheorem{#1}{#2}{#3}{#4}%
\NewEnviron{#1rep}[1][]{%
- \begin{#1}[##1]\BODY\end{#1}%
+ \begin{#1}[##1]\axp@redefinelabels\BODY\end{#1}%
}
}
\let\inlineproof\proof
@@ -143,13 +172,17 @@
\let\nosectionappendix\relax
}
{
- \newwrite\axp@proofsfile
- \immediate\openout\axp@proofsfile=\jobname.axp
- \immediate\write\axp@proofsfile{%
- \noexpand\makeatletter
- \noexpand\let\noexpand\proof\noexpand\axp@oldproof
- \noexpand\let\noexpand\endproof\noexpand\endaxp@oldproof
- \noexpand\let\noexpand\section\noexpand\axp@oldsection
+ \AtBeginDocument{
+ \newwrite\axp@proofsfile
+ \immediate\openout\axp@proofsfile=\jobname.axp
+ }
+ \AtBeginDocument{
+ \immediate\write\axp@proofsfile{%
+ \noexpand\makeatletter
+ \noexpand\let\noexpand\proof\noexpand\axp@oldproof
+ \noexpand\let\noexpand\endproof\noexpand\endaxp@oldproof
+ \noexpand\let\noexpand\section\noexpand\axp@oldsection
+ }
}
\def\FVB@VerbatimOut{%
\@bsphack
@@ -168,34 +201,92 @@
{\endVerbatimOut}
\newtoggle{axp@seenreptheorem}
\newcounter{axp@rpcounter}
+ \newcounter{axp@equation}
+ \newcounter{axp@equationx}
\def\axp@newtheoremrep#1[#2]#3[#4]{%
\expandafter\let\csname #1\endcsname\undefined
\expandafter\let\csname c@#1\endcsname\undefined
\axp@newtheorem{#1}{#2}{#3}{#4}%
\expandafter\pretocmd\csname #1\endcsname{\noproofinappendix}{}{}%
\axp@newtheorem*{axp@#1rp}{#3}%
+ \axp@forward@setup{#1}{#2}{#3}{#4}%
\NewEnviron{#1rep}[1][]{%
+ \ifthenelse{\equal{\axp@repeqn}{same}}{%
+ \setcounter{axp@equation}{\value{equation}}%
+ }{}%
\addtocounter{axp@rpcounter}{1}%
\ifx\relax##1\relax
- \begin{#1}\label{axp@r\roman{axp@rpcounter}}\BODY\end{#1}%
+ \axp@with@forward{#1}{\begin{#1}}\label{axp@r\roman{axp@rpcounter}}\BODY\end{#1}%
\else
- \begin{#1}[##1]\label{axp@r\roman{axp@rpcounter}}\BODY\end{#1}%
+ \axp@with@forward{#1}{\begin{#1}[##1]}\label{axp@r\roman{axp@rpcounter}}\BODY\end{#1}%
\fi
\global\toggletrue{axp@seenreptheorem}%
\global\expandafter\let\csname rplet\roman{axp@rpcounter}%
\endcsname
\BODY
\axp@writesection%
+ \ifthenelse{\equal{\axp@repeqn}{same}}{%
+ \immediate\write\axp@proofsfile{%
+ \noexpand\setcounter{axp@equationx}{\value{equation}}%
+ \noexpand\setcounter{equation}{\theaxp@equation}%
+ }%
+ }{}%
\immediate\write\axp@proofsfile{%
\noexpand\begin{axp@#1rp}
[\noexpand\ref{axp@r\roman{axp@rpcounter}}%
\@ifnotempty{##1}{ \unexpanded{##1}}]%
- \noexpand\let\noexpand\label\noexpand\@gobble%
+ \noexpand\axp@forward@target{axp@fw@r\roman{axp@rpcounter}}{}%
+ \noexpand\axp@redefinelabels
\expandafter\noexpand\csname rplet\roman{axp@rpcounter}%
\endcsname
\noexpand\end{axp@#1rp}
- }
- }
+ }%
+ \ifthenelse{\equal{\axp@repeqn}{same}}{%
+ \immediate\write\axp@proofsfile{%
+ \noexpand\setcounter{equation}{\value{axp@equationx}}%
+ }%
+ }{}%
+ }%
+ }
+
+ \newcommand{\axp@with@forward}[2]{%
+ \ifthenelse{\equal{\axp@appendix}{strip}}{#2}{
+ \global\booltrue{axp@forward}%
+ \ifcsundef{axp@old@the\csname axp@cn@#1\endcsname}{%
+ \csletcs{axp@old@the\csname axp@cn@#1\endcsname}{the\csname axp@cn@#1\endcsname}%
+ \csletcs{theH\csname axp@cn@#1\endcsname}{the\csname axp@cn@#1\endcsname}%
+ \csdef{the\csname axp@cn@#1\endcsname}{%
+ \protect\axp@forward@link{axp@fw@r\roman{axp@rpcounter}}%
+ {\csname axp@old@the\csname axp@cn@#1\endcsname\endcsname}%
+ }%
+ }{}%
+ #2%
+ \ifcsdef{axp@old@the\csname axp@cn@#1\endcsname}{%
+ \csletcs{the\csname axp@cn@#1\endcsname}{axp@old@the\csname axp@cn@#1\endcsname}%
+ }{}%
+ \global\boolfalse{axp@forward}
+ }}%
+ \newbool{axp@forward}
+ \newcommand{\axp@forward@link}[2]{%
+ \ifbool{axp@forward}{%
+ \ifcsdef{hyperlink}{%
+ \hyperlink{#1}{#2}%
+ }{%
+ #2%
+ }%
+ }{%
+ #2%
+ }%
+ }%
+ \newcommand{\axp@forward@target}[2]{%
+ \ifcsname hypertarget\endcsname
+ \hypertarget{#1}{#2}%
+ \else
+ #2%
+ \fi
+ }
+ \newcommand{\axp@forward@setup}[4]{%
+ \csedef{axp@cn@#1}{\ifblank{#4}{\ifblank{#2}{#1}{#2}}{#1}}%
}
\newcommand\noproofinappendix{%
\global\togglefalse{axp@seenreptheorem}%
@@ -245,15 +336,15 @@
}
\let\axp@oldsection\section
\def\section{\@ifstar\@section\@@section}
- \def\@section#1{%
- \global\edef\axp@sectitle{#1}%
- \axp@oldsection*{#1}%
- \addtocounter{axp@seccounter}{1}%
- \label{axp@s\roman{axp@seccounter}}%
- }
- \def\@@section#1{%
- \global\edef\axp@sectitle{#1}%
- \axp@oldsection{#1}%
+ \newcommand{\@section}[2][\relax]{\axp@@@section{*}{#1}{#2}}%
+ \newcommand{\@@section}[2][\relax]{\axp@@@section{}{#1}{#2}}%
+ \newcommand{\axp@@@section}[3]{%
+ \global\def\axp@sectitle{#3}%
+ \ifx\relax#2\relax
+ \axp@oldsection#1{#3}%
+ \else
+ \axp@oldsection#1[{#2}]{#3}%
+ \fi
\addtocounter{axp@seccounter}{1}%
\label{axp@s\roman{axp@seccounter}}%
}
@@ -263,18 +354,27 @@
\newcommand\axp@writesection{%
\ifx\axp@sectitle\@empty
\else
- \immediate\write\axp@proofsfile{%
- \noexpand\def\noexpand\axp@tmp{%
+ \edef\axp@tmp{%
+ \noexpand\global\noexpand\def
+ \expandonce{\csname axp@protectref@\roman{axp@seccounter}\endcsname}{%
\noexpand\ref{axp@s\roman{axp@seccounter}}%
- }
+ }%
+ }%
+ \immediate\write\@auxout{\expandonce\axp@tmp}
+ \immediate\write\axp@proofsfile{%
+ \expandonce\axp@tmp^^J%
\noexpand\axp@section{%
- \noexpand\appendixsectionformat{\protect\noexpand\axp@tmp}%
- {\axp@sectitle}%
+ \noexpand\appendixsectionformat{%
+ \protect
+ \expandonce{\csname axp@protectref@\roman{axp@seccounter}\endcsname}%
+ }{\expandonce\axp@sectitle}%
}%
}%
\nosectionappendix
\fi
}
+ \let\axp@oldtableofcontents\tableofcontents
+ \def\tableofcontents{{\let\section\axp@oldsection\axp@oldtableofcontents}}
\ifthenelse{\equal{\axp@appendix}{append}}{
\let\axp@oldbibliography\bibliography
\renewcommand\bibliography[1]{%
@@ -320,13 +420,6 @@
\patchcmd{\thebibliography}{References}{\protect\refname}{}{}
\newcommand{\refname}{REFERENCES}
\renewcommand{\appendixrefname}{REFERENCES FOR THE APPENDIX}
- \def\section{\@ifstar\@section{\@dblarg{\@@section}}}
- \def\@@section[#1]#2{%
- \global\edef\axp@sectitle{#2}%
- \axp@oldsection{#2}%
- \addtocounter{axp@seccounter}{1}%
- \label{axp@s\roman{axp@seccounter}}%
- }
\fi
\@ifclassloaded{acmart}{
\newtheoremstyle{mystyle}