1

I would greatly prefer sticking with using the apxproof package as otherwise I would be forced to migrate all of my proofs in my document manually. If I can redefine the numbering somehow to add the word 'Appendix' it would be much easier. There is a \appendixsectionformat command that can be redefined but this only changes what happens after the "A." part of the appendix section headings. I.e., "A. [Changes the text here]".

For example, the following code

\documentclass[11pt]{article}
\usepackage[bibliography = common]{apxproof}
\usepackage{amsmath, amsthm}
\usepackage{hyperref}

\begin{document}

\section{Introduction}

\section{Main}

\begin{theorem} \label{theorem:label} This is an example theorem.
\end{theorem}
\begin{toappendix} % This is from the apxproof package
\begin{proof}[\hypertarget{proof:theorem:label}{Proof of Theorem \ref{theorem:label}}] 

The proof goes here.

\end{proof}
\end{toappendix}

\end{document}

will generate a document that creates sections "1. Introduction", "2. Main", and then "A. Proofs for Section 2 (Main)". The Theorem statement appears in section 2 but its proof appears in the appendix A. My goal is for the appendix section heading to instead state "Appendix A. Proofs for Section 2 (Main)".

From the apxproof documentation, the current appearance might look like as follows (replace the word 'Usage' with 'Main' and 'Foobar' with 'Theorem'): enter image description here

If relevant, I found this in the .sty file for apxproof:

\newcommand\axp@writesection{%
    \ifx\axp@sectitle\@empty
    \else
      \edef\axp@tmp{%
        \noexpand\global\noexpand\def
        \expandonce{\csname axp@protectref@\roman{axp@seccounter}\endcsname}{%
          \noexpand\ref{axp@s\roman{axp@seccounter}}%
        }%
      }%
      \immediate\write\@auxout{\expandonce\axp@tmp}
      \immediate\write\axp@proofsfile{%
        \expandonce\axp@tmp^^J%
        \noexpand\axp@section{%
          \noexpand\appendixsectionformat{%
            \protect
            \expandonce{\csname axp@protectref@\roman{axp@seccounter}\endcsname}%
          }{\expandonce\axp@sectitle}%
        }%
      }%
      \nosectionappendix
    \fi
  }

I'm wondering if this is where the modification can be done, and how I can modify this part of the code if so.

2
  • 1
    Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your issue and mark in an screenshot of the result what you want to change. Then we do not have to guess what you are doing ...
    – Mensch
    Jan 27 at 22:57
  • @Mensch Thanks for the suggestion, I have added sample code + screenshot that should make the issue clearer. Jan 27 at 23:32

1 Answer 1

0

Here is one fix:

For each section that has a corresponding appendix section, you can insert the following code.

\section{My first section with proofs}\label{first:section}

\begin{toappendix}
   \section*{Appendix A. Proofs for Section \ref{first:section}}
   % This version removes the numbering from the table of contents/document outline
\end{toappendix}

%
% Your theorems/proofs go here
%

\section{My second section with proofs}\label{second:section}

\begin{toappendix}
   \section*{Appendix B. Proofs for Section \ref{second:section}}
   \addcontentsline{toc}{section}{\protect\numberline{}Appendix B. Proofs for Section \ref{second:section} (My second section with proofs)} 
   \renewcommand{\theequation}{B.\arabic{equation}}
   % This version adds back in the numbering to the table of contents / document outline, as well as sets equation numbering
\end{toappendix}

It is important you use \section* otherwise the apxproof package will append its own numbering, e.g., 'A. Appendix A.' However, this means you will lose the numbering and appearance in the table of contents. To solve this, use the second example, where \addcontentsline allows you to manually reinsert in the numbering into the table of contents. Moreover, you will also lose the section part of the equation numbering. For example, in appendix A, your equation labels will look like (.1), (.2) instead of (A.1), (A.2). The \renewcommand{\theequation}{B.\arabic{equation}} line added in the second appendix section above will give equation labels the proper numbering (B.1), (B.2), and so-on..

This is a somewhat manual solution, but you only have to do this once per appendix required. If you just have proofs in one section, for example, you only need to manually add this code once. There may be a way to get the actual section heading text when using the \addcontentsline but I am unaware of such a solution. But most importantly, this lets you leave the location of the theorems/proofs in the text untouched.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .