2

I have a problem with cross-referencing subsections in the appendix using the AER-AEA document class. Here is an example:

\documentclass[AER]{AEA}
\newtheorem{proposition}{Proposition}

\begin{document}

\begin{proposition}\label{Prop1}
Interesting proposition.
\end{proposition}

Proof of Proposition~\ref{Prop1} is in Appendix~\ref{appendix_A1}.\\

\appendix
\section{Appendix}
\subsection{Proof of Proposition~\ref{Prop1}}\label{appendix_A1}
Proof is here.

\end{document}

This code gives:

Proof of Proposition 1 is in Appendix A.A1.

But I would like to get:

Proof of Proposition 1 is in Appendix A1.

5
  • Where is this AEA document class from?
    – user31729
    Jul 19, 2017 at 15:48
  • More to the point, does it support chapters? Try printing \thechapter or \thesection or \thesubsection in the appendix. Jul 19, 2017 at 16:22
  • It is the LaTeX style for The American Economic Review journal of the American Economic Association . (aeaweb.org)
    – Lednacek
    Jul 19, 2017 at 16:46
  • When I put \thesubsection after "Proof is here." I get "A1" on the pdf output.
    – Lednacek
    Jul 19, 2017 at 16:48
  • In the aux file you should find \newlabel{appendix_A1}{{A1}{1}} Jul 20, 2017 at 4:24

1 Answer 1

2

The AEA class

does

\renewcommand\thesubsection{\thesection\@arabic\c@subsection}

in the \appendix command, i.e. prepending with \thesection, which is \@Alph\c@section effectively.

The reference format \p@subsection can be changed to use \theproposition only, by removing specific code for subsection.

Please note that journal editors might reject this change.

Edit: Some explanations

The macro \g@addto@macro adds additional code to an existing macro code, so \g@addto@macro{\appendix}{foo} would lead to printing foo if \appendix has been used.

Since this \g@addto@macro is a macro with @ - letter in its name, the \makeatletter...\makeatother macro pair is needed to allow @ in macro names.

The \AtBeginDocument hook 'guarantees' that our local changes to \appendix are done at the beginning of the document, after all other \AtBeginDocument - hooks that are provided by the class or the packages, so our changes are the last in this chain of commands.

\documentclass[AER]{AEA}
\newtheorem{proposition}{Proposition}


\makeatletter
\AtBeginDocument{
\g@addto@macro{\appendix}{\renewcommand{\p@subsection}{}}
}
\makeatother


\begin{document}

\begin{proposition}\label{Prop1}
Interesting proposition.
\end{proposition}

Proof of Proposition~\ref{Prop1} is in Appendix~\ref{appendix_A1}.\\

\appendix
\section{Appendix}
\subsection{Proof of Proposition~\ref{Prop1}}\label{appendix_A1}
Proof is here.

\end{document}

enter image description here

4
  • Thanks so much! Completely solved my problem! Fingers crossed so that it goes through at the journal. Just for my own education, where could I find any material to help me understand what exactly this bit of code does? \makeatletter \AtBeginDocument{ \g@addto@macro{\appendix}{\renewcommand{\p@subsection}{}} } \makeatother so that next time I can do it myself? Many thanks again!
    – Lednacek
    Jul 20, 2017 at 10:17
  • @Lednacek: Added some explanation
    – user31729
    Jul 20, 2017 at 20:26
  • 1
    Thank you SO much! This is very clear and extremely helpful!
    – Lednacek
    Jul 21, 2017 at 16:07
  • @Lednacek: Forgot to mention the source of such material: Well, reading the LaTeX core code in latex.ltx and the class files helps a lot, but of course, the learning curve is steep (it was and sometimes still is for me too). ... and you find some 'dirty' tricks here on TeX.SE of course as well ;-)
    – user31729
    Jul 21, 2017 at 16:14

You must log in to answer this question.

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