A redundant proof section appears when the appendix is not inline
Hello, I seemed to bump into a bug. Here is a minimal working example:
\documentclass{article}
\usepackage{apxproof}
\newtheoremrep{theorem}{Theorem}
\newtheoremrep{proposition}{Proposition}
\author{Author}
\begin{document}
\title{Title}
\maketitle
\section{A Section}
\begin{propositionrep}
This is a proposition
\end{propositionrep}
\begin{proof}
This is a proof
\end{proof}
\section{Another Section}
This is a section without proofs
\begin{toappendix}
\section{Appendix Section}
\end{toappendix}
\end{document}
The above code works fine. But if I change \section{Appendix Section} to \include{appendix}, an empty section "B Proofs for Section 2 (Another Section)" will be created in the appendix even though Section 2 has no proofs. Cheers!
Thanks for your bug report. I am aware of the issue, but this is something that is not easily fixable: the current behavior is as follows:
- if
\nosectionappendixis used, no section is created in the appendix; - if there is no appendix material at all within a
\section, no section is created in the appendix; - if there is a
toappendixenvironment within a\section, apxproof first checks whether the very first command within thetoappendixis a\sectioncommand; or whether it is an\inputof a file whose very first command is a\sectioncommand; if such a\sectioncommand is found, no section is created in the appendix; - otherwise, a section is created in the appendix.
The special \input check already does kind of what you want, but for \input and not \include; I cannot do the exact same thing for \include, as \include has other side effects than simply reading the file (in particular, setting up a new .aux file) that are not easy to simulate. I would have to think whether there is a better way to handle this.
That being said, the following two workarounds should work for you:
- If you actually don't need the extra features of
\include, use\input(which is usually more versatile anyway). - Otherwise, just put
\nosectionappendixafter the\sectionfor which no section in appendix should be produced.
Please let me know whether these workarounds are ok for you.
@PierreSenellart Thanks a lot for the explanations and workarounds! Using \input instead of \include works for me. By the way, I just noticed that newlines before the first \section or \input in the toappendix environment also lead to a redundant section:
\begin{toappendix}
\section{Appendix Section}
\end{toappendix}
Perhaps you can skip newlines when you check the first command? Anyway, thank you again for creating this convenient package :-)