From ed8e46e860bca3acafba4475ee050d009cbef8c7 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 17 Mar 2017 21:35:40 +0000
Subject: apxproof (17may17)

git-svn-id: svn://tug.org/texlive/trunk@43527 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/source/latex/apxproof/apxproof.dtx  | 133 +++++++++++++++++----
 1 file changed, 108 insertions(+), 25 deletions(-)

(limited to 'Master/texmf-dist/source/latex/apxproof/apxproof.dtx')

diff --git a/Master/texmf-dist/source/latex/apxproof/apxproof.dtx b/Master/texmf-dist/source/latex/apxproof/apxproof.dtx
index 95141af7d5a..9f46f84e254 100644
--- a/Master/texmf-dist/source/latex/apxproof/apxproof.dtx
+++ b/Master/texmf-dist/source/latex/apxproof/apxproof.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2016 by Pierre Senellart
+% Copyright (C) 2016-2017 by Pierre Senellart
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -24,7 +24,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
 %<package>\ProvidesPackage{apxproof}
-%<package>  [2017/02/06 v1.0.3 Automatic proofs in appendix]
+%<package>  [2017/03/17 v1.0.4 Automatic proofs in appendix]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -44,7 +44,7 @@
 %</driver>
 % \fi
 %
-% \CheckSum{446}
+% \CheckSum{482}
 %
 % \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
@@ -62,6 +62,27 @@
 %   Grave accent  \`     Left brace    \{     Vertical bar  \|
 %   Right brace   \}     Tilde         \~}
 %
+% \changes{v1.0.4}{2017/03/02}{Show options commented on in margin and index}
+%\iffalse
+% Taken from xkeyval.dtx
+%\fi
+%\makeatletter
+%\def\DescribeOption#1{\leavevmode\@bsphack
+%              \marginpar{\raggedleft\PrintDescribeOption{#1}}%
+%              \SpecialOptionIndex{#1}\@esphack\ignorespaces}
+%\def\PrintDescribeOption#1{\strut\emph{option}\\\MacroFont #1\ }
+%\def\SpecialOptionIndex#1{\@bsphack
+%    \index{#1\actualchar{\protect\ttfamily#1}
+%           (option)\encapchar usage}%
+%    \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
+%           usage}\@esphack}
+%\def\DescribeOptions#1{\leavevmode\@bsphack
+%  \marginpar{\raggedleft\strut\emph{options}%
+%  \@for\@tempa:=#1\do{%
+%    \\\strut\MacroFont\@tempa\SpecialOptionIndex\@tempa
+%  }}\@esphack\ignorespaces}
+%\makeatother
+%
 % \changes{v1.0.0}{2016/10/31}{Initial released version}
 % \changes{v1.0.1}{2016/11/07}{Prevent empty bibliography environment;
 % fix typos}
@@ -275,7 +296,7 @@ This is the proof of the repeated foobar.
 % \end{example}
 % 
 % \subsection{Bibliography}
-% \textsf{apxproof} automatically adds a bibliography in the appendix
+% By default, \textsf{apxproof} automatically adds a bibliography in the appendix
 % with only the references cited in the appendix material. This allows for a
 % clean separation of references used solely in the main text, and those
 % used in the appendix.
@@ -299,7 +320,14 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % default, it does). See
 % Section~\ref{sec:customization} for how to configure the appearance of
 % that bibliography.
+%
+% \DescribeOption{bibliography}
+% In order to use a single appendix for the main text and the
+% bibliography, one can specify the
+% value |common| to the |bibliography| option when loading the package.
+% (By default this option is set to |separate|.)
 % \subsection{Mode}
+% \DescribeOption{appendix}
 % An optional \meta{mode} can be specified when loading the package:
 % \begin{quote}|\usepackage[appendix=|\meta{mode}|]{apxproof}|\end{quote}
 % \meta{mode} can take one of the following three values:
@@ -333,9 +361,15 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % \item[\textbackslash|appendixbibliographyprelim|]\DescribeMacro{\appendixbibliographyprelim} contains arbitrary code that is executed
 % just before the production of the bibliography in appendix, which can
 % be used to configure the way it is displayed.
+% \item[\textbackslash|appendixprelim|]\DescribeMacro{\appendixprelim} contains arbitrary code that is executed
+% just before the production of the appendix, which can
+% be used to configure the way it is displayed. By default, this command
+% contains |\clearpage\onecolumn| (the appendix is typeset on a new page
+% in single-column mode) but redefining this option allows changing this
+% behavior.
 % \end{description}
 %
-% \subsection{Advanced Commands}
+% \subsection{Advanced Features}
 % We now describe a few advanced macros and environments, whose usage is limited to
 % special cases:
 % \begin{description}
@@ -396,7 +430,7 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % Issues not listed here should be reported to the author.
 %
 % \section{License}
-% Copyright \textcopyright{} 2016 by Pierre Senellart.
+% Copyright \textcopyright{} 2016--2017 by Pierre Senellart.
 % 
 % This work may be distributed and/or modified under the conditions of the
 % \LaTeX{} Project Public License, either version 1.3 of this license or (at
@@ -463,14 +497,23 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % will simply have no effect. On the other hand, some other document
 % classes (e.g., \textsf{llncs} or \textsf{sig-alternate}) define a
 % |proof| environment that conflicts with \textsf{amsthm}, so we have to
-% undefine this environment before loading \textsf{amsthm}.
+% undefine this environment before loading \textsf{amsthm}. In that case,
+% we reestablish the existing proof environments, in case they had been
+% customized (e.g., \textsf{sig-alternate})
+% \changes{v1.0.4}{2017/03/08}{Re-establish custom proof environments}
 %    \begin{macrocode}
 \@ifpackageloaded{amsthm}{
   }{
+    \let\apx@oldamsthmproof\proof
+    \let\apx@oldamsthmendproof\endproof
     \let\proof\undefined
     \let\endproof\undefined
   }
 \RequirePackage{amsthm}
+\ifdefined\apx@oldamsthmproof
+  \let\proof\apx@oldamsthmproof
+  \let\endproof\apx@oldamsthmendproof
+\fi
 %    \end{macrocode}
 % \end{itemize}
 % \subsection{Option Processing}
@@ -480,20 +523,36 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 %    \begin{macrocode}
 \makeatletter
 %    \end{macrocode}
-% \begin{macro}{\axp@appendix}
-% We setup the processing of options using \textsf{keyval} facilities;
-% the only declared option is named |appendix|, with a default value of
-% |append|:
+% We setup the processing of options using \textsf{keyval} facilities.
 %    \begin{macrocode}
 \SetupKeyvalOptions{
   family=axp,
   prefix=axp@
 }
+%    \end{macrocode}
+% We declare the following options:
+% \begin{itemize}
+%   \item |appendix|, with a default value of |append| (other possible
+%     values: |strip|, |inline|);
+%   \item |bibliography|, with a default value of |separate| (other
+%     possible value: |common|);
+% \end{itemize}
+% \begin{macro}{\axp@appendix}
+%    \begin{macrocode}
 \DeclareStringOption[append]{appendix}
-\ProcessLocalKeyvalOptions*
 %    \end{macrocode}
 % \end{macro}
-% We check that the value of the |appendix| option is valid, and add a
+% \begin{macro}{\axp@bibliography}
+% \changes{v1.0.4}{2017/03/02}{\texttt{bibliography} option}
+%    \begin{macrocode}
+\DeclareStringOption[separate]{bibliography}
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
+\ProcessLocalKeyvalOptions*
+%    \end{macrocode}
+% We check that the value of the |appendix| and
+% |bibliography| options are valid, and add a
 % message to the compilation log.
 %    \begin{macrocode}
 \ifthenelse{\equal{\axp@appendix}{append}}{
@@ -506,6 +565,14 @@ This is a citation in the appendix~\cite{proofsAreHard}.
   \errmessage{Error: unsupported option appendix=\axp@appendix for
   package apxproof}
 }}}
+\ifthenelse{\equal{\axp@bibliography}{separate}}{
+  \message{apxproof: Separate bibliography for appendix material}
+}{\ifthenelse{\equal{\axp@bibliography}{common}}{
+  \message{apxproof: Common bibliography for appendix and main text}
+}{
+  \errmessage{Error: unsupported option bibliography=\axp@bibliography for
+  package apxproof}
+}}
 %    \end{macrocode}
 % \subsection{Macros Common to All Compilation Modes}
 % \begin{macro}{\newtheoremrep}
@@ -524,9 +591,7 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % Simple |proofsketch| environment.
 % \changes{v1.0.3}{2016/12/16}{Ignore spaces after beginning of Proof sketch}
 %    \begin{macrocode}
-\newenvironment{proofsketch}
-  {\vskip3pt\noindent\textit{Proof sketch.} \upshape\ignorespaces}
-  {\hfill\qed\vskip3pt}
+  \newenvironment{proofsketch}{\begin{axp@oldproof}[Proof sketch]}{\end{axp@oldproof}}
 %    \end{macrocode}
 % \end{environment}  
 % \begin{macro}{\thmhead}  
@@ -546,37 +611,48 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 % \begin{macro}{\appendixrefname}
 % \begin{macro}{\appendixbibliographystyle}
 % \begin{macro}{\appendixbibliographyprelim}
+% \begin{macro}{\appendixprelim}
+% \changes{v1.0.4}{2017/03/03}{Configurable appendix style}
 % \begin{macro}{\appendixsectionformat}
-% We provide sensible defaults for these three user-customizable macros.
+% We provide sensible defaults for these four user-customizable macros.
 % Even though they are only useful in append mode, we define them for
 % all modes so that a |\renewcommand| works in all cases.
 %    \begin{macrocode}
 \newcommand{\appendixrefname}{References for the Appendix}
 \newcommand{\appendixbibliographystyle}{alpha}
 \newcommand{\appendixbibliographyprelim}{}
+\newcommand{\appendixprelim}{\clearpage\onecolumn}
 \newcommand{\appendixsectionformat}[2]{Proofs for Section~#1 (#2)}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
 % \end{macro}
+% \end{macro}
 % Finally, some class-specific behavior ensures that the theorems created by
 % |\newtheoremrep| appear with the correct style.
 % For now, only the styling for ACM document classes (e.g.,
-% \textsf{sig-alternate}) needs to be adapted.  
+% \textsf{sig-alternate}) and \textsf{llncs} needs to be adapted, as both
+% redefine the proof environments in different ways.
+% \changes{v1.0.4}{2017/03/08}{More faithful theorem style for ACM templates}
+% \changes{v1.0.4}{2017/03/08}{More robust coherent styling of proof sketches}
 %    \begin{macrocode}
 \ifdefined\@acmtitlebox
   \newtheoremstyle{mystyle}
-    {3pt}
-    {3pt}
+    {6pt}
+    {6pt}
     {\itshape}
-    {}
+    {10pt}
     {\scshape}
     {.}
     {.5em}
     {}
   \theoremstyle{mystyle}
+  \renewenvironment{proofsketch}{\begin{axp@oldproof}[sketch]}{\end{axp@oldproof}}
 \fi
+  \@ifclassloaded{llncs}{
+    \renewenvironment{proofsketch}{\begin{axp@oldproof}[sketch]}{\end{axp@oldproof}}
+  }{}
 %    \end{macrocode}
 % \subsection{Inline Compilation Mode}
 %    \begin{macrocode}
@@ -938,16 +1014,22 @@ This is a citation in the appendix~\cite{proofsAreHard}.
 %    \end{macrocode}  
 % \end{macro}
 % \end{macro}
-% After the end of the main text, we add the appendix (on a new page, set
-% in single-column mode) within a |bibunit| environment so as to typeset
-% a separate bibliography for the appendix. There is an extra test to
+% After the end of the main text, we add the appendix (after the command 
+% |\appendixprelim| is issued)
+% within a |bibunit| environment so as to typeset
+% a separate bibliography for the appendix (unless the |bibliography|
+% option is set to |common|). There is an extra test to
 % ensure an empty bibliography environment is not produced.
 %    \begin{macrocode}
     \AtEndDocument{
-      \clearpage\onecolumn\appendix
+      \appendixprelim
+      \appendix
+      \ifthenelse{\equal{\axp@bibliography}{separate}}{
       \begin{bibunit}[\appendixbibliographystyle]
+      }{}
         \immediate\closeout\axp@proofsfile
         \input{\jobname.axp}
+      \ifthenelse{\equal{\axp@bibliography}{separate}}{
         \renewcommand{\refname}{\appendixrefname}
         \let\axp@oldthebibliography\thebibliography
         \renewcommand\thebibliography[1]{%
@@ -955,6 +1037,7 @@ This is a citation in the appendix~\cite{proofsAreHard}.
         \appendixbibliographyprelim
         \putbib
       \end{bibunit}
+      }{}
     }
 %    \end{macrocode}  
 %    \begin{macrocode}  
-- 
cgit v1.2.3

