Open peiranxiao opened 5 months ago
There is nothing that natively allows this. It might be a good idea, though not sure what the best way is to make this customizable.
But here are two workarounds. The first disables section creation and manually writes the structures:
\documentclass{article}
\usepackage{apxproof}
\newtheoremrep{theorem}{Theorem}
\begin{document}
\begin{toappendix}
\section{Proofs}
\end{toappendix}
\section{First}
\label{sec:first}
\nosectionappendix
\begin{toappendix}
\subsection{Proof of Section~\ref{sec:first}}
\end{toappendix}
\begin{theoremrep}
First theorem
\end{theoremrep}
\begin{proof}
First proof
\end{proof}
\section{Second}
\label{sec:second}
\nosectionappendix
\begin{toappendix}
\subsection{Proof of Section~\ref{sec:second}}
\end{toappendix}
\begin{theoremrep}
Second theorem
\end{theoremrep}
\begin{proof}
Second proof
\end{proof}
\end{document}
The second one redefines the command within the appendix responsible of creating a section to create a subsection instead, which is more concise but less readable:
\documentclass{article}
\usepackage{apxproof}
\newtheoremrep{theorem}{Theorem}
\begin{document}
\begin{toappendix}
\section{Proofs}
\begingroup\makeatletter\let\axp@oldsection\subsection\makeatother
\end{toappendix}
\section{First}
\label{sec:first}
\begin{theoremrep}
First theorem
\end{theoremrep}
\begin{proof}
First proof
\end{proof}
\section{Second}
\label{sec:second}
\begin{theoremrep}
Second theorem
\end{theoremrep}
\begin{proof}
Second proof
\end{proof}
\begin{toappendix}
\endgroup
\end{toappendix}
\end{document}
I am keeping this issue open while I am thinking of a way to add appropriate configuration here.
Thank you. Both work well!
A follow-up question:
I understand the original appendices can be added using the toappendix
environment. But this way I lose the SyncTeX support (#11).
If I put them in the standard appendix environment, Appendix A Proofs will be generated at the end of the document. A workaround I tried is:
\def\onlinedraft{1}`
\ifx\onlinedraft\undefined
\appendix
\setcounter{section}{1}
\input{appendix.tex}
\begin{toappendix}
\endgroup
\end{toappendix}
% Appendix A Proofs will be generated at the end
\else
\begin{toappendix}
\input{appendix.tex}
\endgroup
\end{toappendix}
\fi
and uncomment \def\onlinedraft{1}
when I need to use SyncTeX while editing the appendices.
I am wondering if there is a better way of doing this.
You can use the regular \appendix
command to create an appendix, however:
\let\appendix\relax\let\appendixprelim\relax
after your \appendix
command.\appendix
will be put before all apxproof content – there is no way around it, this is how apxproof works: there are to flows of content, the regular flow of the document and the appendix flow generated by apxproof, and the appendix flow is always after the regular flow.For instance, this works:
\documentclass{article}
\usepackage{apxproof}
\newtheoremrep{theorem}{Theorem}
\begin{document}
\begin{toappendix}
\section{Proofs}
\end{toappendix}
\section{First}
\label{sec:first}
\nosectionappendix
\begin{toappendix}
\subsection{Proof of Section~\ref{sec:first}}
\end{toappendix}
\begin{theoremrep}
First theorem
\end{theoremrep}
\begin{proof}
First proof
\end{proof}
\section{Second}
\label{sec:second}
\nosectionappendix
\begin{toappendix}
\subsection{Proof of Section~\ref{sec:second}}
\end{toappendix}
\begin{theoremrep}
Second theorem
\end{theoremrep}
\begin{proof}
Second proof
\end{proof}
\appendix
\let\appendix\relax\let\appendixprelim\relax
\section{Appendix}
This is in the main content of the appendix.
\end{document}
If 2. is not an issue for you, this seems like a viable solution. Otherwise, the only way is to use a toappendix
environment, and indeed you will lose SyncTeX features.
(Please open a new issue if still relevant; this has little to do with the original issue.)
I am wondering if the package can put proofs in different subsections within a single section in the appendix. For example: instead of
I realize
\nosectionappendix
can make the proofs appear in the same section and\renewcommand{\appendixsectionformat}[2]{Proofs}
can customize the section title, but it will not create different subsections.