From 68870d6c60b48ad4fb4d0395942495c8409ef0c3 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 9 Oct 2019 21:56:43 +0000
Subject: apxproof (9oct19)

git-svn-id: svn://tug.org/texlive/trunk@52324 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/apxproof/apxproof.sty | 118 +++++++++++++---------
 1 file changed, 69 insertions(+), 49 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/apxproof/apxproof.sty')

diff --git a/Master/texmf-dist/tex/latex/apxproof/apxproof.sty b/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
index 34769d2bbd6..ff6a5fe72e4 100644
--- a/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
+++ b/Master/texmf-dist/tex/latex/apxproof/apxproof.sty
@@ -6,7 +6,7 @@
 %%
 %% apxproof.dtx  (with options: `package')
 %% 
-%% Copyright (C) 2016-2017 by Pierre Senellart
+%% Copyright (C) 2016-2019 by Pierre Senellart
 %% 
 %% This work may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either version 1.3
@@ -27,8 +27,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{apxproof}
-  [2019/01/28 v1.1.1 Automatic proofs in appendix]
-\RequirePackage{bibunits}
+  [2019/10/08 v1.2.0 Automatic proofs in appendix]
 \RequirePackage{environ}
 \RequirePackage{etoolbox}
 \RequirePackage{fancyvrb}
@@ -66,6 +65,7 @@
   package apxproof}
 }}}
 \ifthenelse{\equal{\axp@bibliography}{separate}}{
+  \RequirePackage{bibunits}
   \message{apxproof: Separate bibliography for appendix material}
 }{\ifthenelse{\equal{\axp@bibliography}{common}}{
   \message{apxproof: Common bibliography for appendix and main text}
@@ -81,6 +81,22 @@
   \errmessage{Error: unsupported option repeqn=\axp@repeqn\ for
   package apxproof}
 }}
+\def\axp@newtheoremrep@definetheorem#1#2#3#4{%
+  \expandafter\let\csname #1\endcsname\undefined
+  \ifcsname c@#1\endcsname
+    \expandafter\expandafter\expandafter\let\expandafter\expandafter
+      \csname c@axp@#1\endcsname\csname c@#1\endcsname
+    \expandafter\let\csname c@#1\endcsname\undefined
+  \fi
+  \axp@newtheorem{#1}{#2}{#3}{#4}%
+  \ifcsname c@axp@#1\endcsname
+    \ifx\relax#2\relax
+      \expandafter\expandafter\expandafter\let\expandafter\expandafter
+        \csname c@#1\endcsname\csname c@axp@#1\endcsname
+    \else
+    \fi
+  \fi
+}
 \def\axp@newtheorem{\@ifstar\@@axp@newtheorem\@axp@newtheorem}
 \def\@axp@newtheorem#1#2#3#4{%
   \ifx\relax#4\relax
@@ -99,11 +115,7 @@
   \@oparg{\axp@newtheoremrep{#1}[#2]{#3}}[]%
 }
   \newenvironment{proofsketch}{\begin{axp@oldproof}[Proof sketch]}{\end{axp@oldproof}}
-\AtBeginDocument{%
-  \def\thmhead#1#2#3{%
-    \thmname{#1}\thmnumber{\@ifnotempty{#1}{ }\@upn{#2}}%
-    \thmnote{ #3}}%
-}
+\newcommand{\mainbodyrepeatedtheorem}{}
 \newcommand{\appendixrefname}{References for the Appendix}
 \newcommand{\appendixbibliographystyle}{alpha}
 \newcommand{\appendixbibliographyprelim}{}
@@ -112,8 +124,8 @@
   \let\axp@oldproof\proof
   \let\endaxp@oldproof\endproof
   \newcommand{\axp@redefinelabels}{%
-    \providecommand\label@in@display{}
-    \ifthenelse{\equal{\axp@appendix}{inline}}{
+    \providecommand\label@in@display{}%
+    \ifthenelse{\equal{\axp@appendix}{inline}}{%
       \let\axp@oldlabel\label
       \let\axp@oldlabel@in@display\label@in@display
       \renewcommand\label[1]{%
@@ -146,19 +158,18 @@
 \def\@@axp@newtheorem#1#2{%
   \spnewtheorem*{#1}{#2}{\upshape\bfseries}{\itshape}%
 }
+\renewenvironment{proofsketch}{\begin{axp@oldproof}[sketch]}{\end{axp@oldproof}}
 \def\@thmcountersep{.}
-\def\@Opargbegintheorem#1#2#3#4{#4\trivlist
-      \item[\hskip\labelsep{#3#1}]{#3 #2\@thmcounterend\ }}
-\def\@spopargbegintheorem#1#2#3#4#5{\trivlist
-      \item[\hskip\labelsep{#4#1\ #2}]{#4 #3\@thmcounterend\ }#5}
   \fi
 \ifthenelse{\equal{\axp@appendix}{inline}}{
   \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}%
+    \axp@newtheoremrep@definetheorem{#1}{#2}{#3}{#4}%
     \NewEnviron{#1rep}[1][]{%
-      \begin{#1}[##1]\axp@redefinelabels\BODY\end{#1}%
+      \ifx\relax##1\relax
+        \begin{#1}\axp@redefinelabels\BODY\end{#1}%
+      \else
+        \begin{#1}[##1]\axp@redefinelabels\BODY\end{#1}%
+      \fi
     }
   }
   \let\inlineproof\proof
@@ -212,9 +223,7 @@
   \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}%
+    \axp@newtheoremrep@definetheorem{#1}{#2}{#3}{#4}%
     \expandafter\pretocmd\csname #1\endcsname{\noproofinappendix}{}{}%
     \axp@newtheorem*{axp@#1rp}{#3}%
     \axp@forward@setup{#1}{#2}{#3}{#4}%
@@ -224,10 +233,12 @@
       }{}%
       \addtocounter{axp@rpcounter}{1}%
       \ifx\relax##1\relax
-        \axp@with@forward{#1}{\begin{#1}}\label{axp@r\roman{axp@rpcounter}}\BODY\end{#1}%
+        \axp@with@forward{#1}{\begin{#1}}\label{axp@r\roman{axp@rpcounter}}%
       \else
-        \axp@with@forward{#1}{\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}}%
       \fi
+      \mainbodyrepeatedtheorem
+      \BODY\end{#1}%
       \global\toggletrue{axp@seenreptheorem}%
       \global\expandafter\let\csname rplet\roman{axp@rpcounter}%
                              \endcsname
@@ -239,16 +250,40 @@
           \noexpand\setcounter{equation}{\theaxp@equation}%
         }%
       }{}%
-      \immediate\write\axp@proofsfile{%
+      \immediate\write\axp@proofsfile{{%
+        \ifdefined\theopargself
+          \noexpand\theopargself
+        \else
+          \noexpand\pretocmd{\noexpand\@begintheorem}{%
+            \noexpand\patchcmd{\noexpand\thmhead}{\noexpand\@acmplainnotefont}{}{}{}%
+            \noexpand\patchcmd{\noexpand\thmhead}{\noexpand\the\noexpand\thm@notefont}{}{}{}%
+            \noexpand\patchcmd{\noexpand\thmhead}{(}{}{}{}%
+            \noexpand\patchcmd{\noexpand\thmhead}{)}{}{}{}%
+          }{}{}
+        \fi
         \noexpand\begin{axp@#1rp}
-          [\noexpand\ref{axp@r\roman{axp@rpcounter}}%
-           \@ifnotempty{##1}{ \unexpanded{##1}}]%
+          [%
+            \noexpand\ref{axp@r\roman{axp@rpcounter}}%
+            \@ifnotempty{##1}{%
+              \ifdefined\theopargself
+              \else
+                \ifdefined\@acmplainnotefont
+                  \noexpand\@acmplainnotefont
+                \else
+                  \noexpand\ifdefined\noexpand\thm@notefont
+                    \noexpand\the\noexpand\thm@notefont
+                  \noexpand\fi
+                \fi
+              \fi
+              {} (\unexpanded{##1})%
+            }%
+          ]%
           \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}}%
@@ -384,11 +419,13 @@
   \let\axp@oldtableofcontents\tableofcontents
   \def\tableofcontents{{\let\section\axp@oldsection\axp@oldtableofcontents}}
   \ifthenelse{\equal{\axp@appendix}{append}}{
-    \let\axp@oldbibliography\bibliography
-    \renewcommand\bibliography[1]{%
-      \defaultbibliography{#1}%
-      \axp@oldbibliography{#1}%
-    }
+    \ifthenelse{\equal{\axp@bibliography}{separate}}{
+      \let\axp@oldbibliography\bibliography
+      \renewcommand\bibliography[1]{%
+        \defaultbibliography{#1}%
+        \axp@oldbibliography{#1}%
+      }
+    }{}
     \AtEndDocument{
       \appendixprelim
       \appendix
@@ -429,29 +466,12 @@
     \newcommand{\refname}{REFERENCES}
     \renewcommand{\appendixrefname}{REFERENCES FOR THE APPENDIX}
   \fi
-  \@ifclassloaded{acmart}{
-  \newtheoremstyle{mystyle}
-    {.5\baselineskip\@plus.2\baselineskip
-      \@minus.2\baselineskip}
-    {.5\baselineskip\@plus.2\baselineskip
-      \@minus.2\baselineskip}
-    {\@acmplainbodyfont}
-    {\@acmplainindent}
-    {\@acmplainheadfont}
-    {.}
-    {.5em}
-    {\thmname{#1}\thmnumber{ #2}\thmnote{ {\@acmplainheadfont #3}}}
-  \theoremstyle{mystyle}
-  }{}
    \ifdefined\lipics@opterrshort
     \renewcommand{\appendixbibliographyprelim}{%
       \global\let\@oldbiblabel\@biblabel
       \def\@biblabel{\hspace*{-2em}\small\@oldbiblabel}%
     }
   \fi
-  \@ifclassloaded{llncs}{
-    \renewenvironment{proofsketch}{\begin{axp@oldproof}[sketch]}{\end{axp@oldproof}}
-  }{}
 }
 \endinput
 %%
-- 
cgit v1.2.3

