summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/apxproof/apxproof.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/apxproof/apxproof.dtx')
-rw-r--r--macros/latex/contrib/apxproof/apxproof.dtx60
1 files changed, 53 insertions, 7 deletions
diff --git a/macros/latex/contrib/apxproof/apxproof.dtx b/macros/latex/contrib/apxproof/apxproof.dtx
index 307934752d..0225d20e77 100644
--- a/macros/latex/contrib/apxproof/apxproof.dtx
+++ b/macros/latex/contrib/apxproof/apxproof.dtx
@@ -24,7 +24,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{apxproof}
-%<package> [2021/06/23 v1.2.2 Automatic proofs in appendix]
+%<package> [2021/09/03 v1.2.3 Automatic proofs in appendix]
%
%<*driver>
\documentclass{ltxdoc}
@@ -45,7 +45,7 @@
%</driver>
% \fi
%
-% \CheckSum{828}
+% \CheckSum{864}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -400,6 +400,15 @@ This is a citation in the appendix~\cite{proofsAreHard}.
% |\ref{|\meta{counter}|-apx}| references the counter in the appendix
% (except in |inline| mode, where both have the same effect).
%
+% \DescribeOption{forwardlinking}
+% Another customization option concerns hyperlinking.
+% Usually, when \textsf{hyperref} is loaded, |foobarrep|
+% environments in the main text have their number link to their repetition in the
+% appendix. To suppress this behavior and have |foobarrep| environments
+% treated as if \textsf{hyperref} were not loaded, one can specify the
+% value |no| to the |forwardlinking| option when loading the package. (By
+% default this option is set to |yes|.)
+%
% \subsection{Advanced Features}
% We now describe a few advanced macros and environments, the usage of
% which is limited to special cases:
@@ -489,7 +498,8 @@ This is a citation in the appendix~\cite{proofsAreHard}.
% \section{Acknowledgments}
% Thanks to Antoine Amarilli for feedback and proofreading. Thanks to K.~D.
% Bauer for the implementation of the forward-linking mechanism, and
-% for various bugfixes.
+% for various bugfixes. Thanks to Leonid Kostrykin for an initial
+% implementation of the |forwardlinking| option.
%
% \StopEventually{
% \PrintChanges
@@ -596,6 +606,12 @@ This is a citation in the appendix~\cite{proofsAreHard}.
\DeclareStringOption[same]{repeqn}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\axp@forwardlinking}
+% \changes{v1.2.3}{2021/07/12}{\texttt{forwardlinking} option}
+% \begin{macrocode}
+\DeclareStringOption[yes]{forwardlinking}
+% \end{macrocode}
+% \end{macro}
% \begin{macrocode}
\ProcessLocalKeyvalOptions*
% \end{macrocode}
@@ -636,6 +652,19 @@ This is a citation in the appendix~\cite{proofsAreHard}.
package apxproof}
}}
% \end{macrocode}
+% \begin{macro}{\axp@forward@suppress}
+% \begin{macrocode}
+\newbool{axp@forward@suppress}
+\ifthenelse{\equal{\axp@forwardlinking}{yes}}{
+}{\ifthenelse{\equal{\axp@forwardlinking}{no}}{
+ \message{apxproof: Disable forward linking}
+ \global\booltrue{axp@forward@suppress}%
+}{
+ \errmessage{Error: unsupported option forwardlinking=\axp@repeqn\ for
+ package apxproof}
+}}
+% \end{macrocode}
+% \end{macro}
% \subsection{Macros Common to All Compilation Modes}
% \begin{macro}{\axp@newtheoremrep@definetheorem}
% \changes{v1.2.0}{2019/10/01}{Restore predefined theorem counters}
@@ -1094,6 +1123,11 @@ This is a citation in the appendix~\cite{proofsAreHard}.
\noexpand\setcounter{equation}{\theaxp@equation}%
}%
}{}%
+ \ifbool{axp@forward@suppress}{%
+ \global\def\axp@refstar{\ref*}
+ }{%
+ \global\def\axp@refstar{\ref}
+ }
\immediate\write\axp@proofsfile{{%
\ifdefined\theopargself
\noexpand\theopargself
@@ -1107,7 +1141,7 @@ This is a citation in the appendix~\cite{proofsAreHard}.
\fi
\noexpand\begin{axp@#1rp}
[%
- \noexpand\ref{axp@r\roman{axp@rpcounter}}%
+ \noexpand\axp@refstar{axp@r\roman{axp@rpcounter}}%
\@ifnotempty{##1}{%
\ifdefined\theopargself
\else
@@ -1203,7 +1237,7 @@ This is a citation in the appendix~\cite{proofsAreHard}.
% \begin{macrocode}
\newbool{axp@forward}
\newcommand{\axp@forward@link}[2]{%
- \ifbool{axp@forward}{%
+ \ifboolexpr{ bool {axp@forward} and not bool {axp@forward@suppress} }{%
\ifcsdef{hyperlink}{%
\hyperlink{#1}{#2}%
}{%
@@ -1489,6 +1523,9 @@ This is a citation in the appendix~\cite{proofsAreHard}.
% bibliography is called \texttt{\textbackslash bibname}}
% \changes{v1.2.1}{2020/02/27}{Ad hoc fix for \textsf{natbib}
% package conflict}
+% \changes{v1.2.3}{2021/08/03}{More robust redefinition of
+% \texttt{thebibliography} environment, for compatibility with
+% \textsf{tocbibind}}
% \begin{macrocode}
\pretocmd{\@enddocumenthook}{%
\ifdefined\NAT@testdef
@@ -1510,8 +1547,17 @@ This is a citation in the appendix~\cite{proofsAreHard}.
\renewcommand{\bibname}{\appendixrefname}
\fi\fi
\let\axp@oldthebibliography\thebibliography
- \renewcommand\thebibliography[1]{%
- \ifx\relax#1\relax\else\axp@oldthebibliography{#1}\fi}
+ \let\endaxp@oldthebibliography\endthebibliography
+ \renewenvironment{thebibliography}[1]{%
+ \def\axp@tmp{#1}%
+ \ifx\axp@tmp\empty
+ \gdef\axp@noappendixbibliography1\relax
+ \else
+ \begin{axp@oldthebibliography}{#1}%
+ \fi
+ }{%
+ \ifdefined\axp@noappendixbibliography\relax\else\end{axp@oldthebibliography}%
+ \fi}
\appendixbibliographyprelim
\putbib
\end{bibunit}