# Change appearance of equation numbers locally

In the MWE below, I would like to have the equation numbers in the Chapter "Appendix" (but only there!) being displayed as follows:

(A.1), (A.2), (A.3) ...

\documentclass{book}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage[titletoc]{appendix}
\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{ntheorem}

\newtheorem{prop}{Proposition}

\numberwithin{equation}{chapter}
\numberwithin{prop}{section}

\begin{document}

\chapter{Test Chapter}
\section{XY}

\begin{prop}
\begin{equation}
1+2=3
\end{equation}
\end{prop}

\begin{appendices}

\newtagform{WithA}{(A}{)}
\usetagform{WithA}
\newcommand{\Aref}{(A\ref{#1})}

\renewcommand\thechapter{}

\makeatletter
\def\chaptermark#1{\markboth{\MakeUppercase{\@chapapp. \  #1}}{}}
\makeatother

\chapter{Additional stuff nobody is interested in}

\titleformat{\section}[runin]
{\normalfont\normalsize\bfseries}{}{1em}{}
\titlespacing*{\section}
{0pt}{3.25ex plus 1ex minus .2ex}{1em}
\titlecontents{section}[1.5em]
{}{}{}{\titlerule*[7.5pt]{.}\contentspage}

\begin{prop}\label{y}
\begin{equation}
a+b=c
\end{equation}
\end{prop}
Equation (\ref{x}) in Proposition \ref{y} is nice.
\end{appendices}

\end{document}


EDIT: I have edited my example --> It now produces the desired output, but it doesn't seem to be very elegant! A major drwaback of my solution is that I am bound to forget to use \Aref insted of \ref when referring to equations in the appendix. Hence a solution which does this automatically would be highly appreciated!

Hence, I modify my question to: Are there any better solutions?

## 2 Answers

Just add

\renewcommand{\theequation}{\Alph{chapter}.\arabic{equation}}


after \begin{appendices}. You'll be able to use \ref or \eqref.

• Thx! Exactly what I was looking for. I have now added a proposition (see edited question) and tried the same thing for the proposition numbering (it should be "Proposition A.1" in the appendix instead of "Proposition .0.2") but I wasn't successful. How would I have to adjust your solution for proposition numbers? – lpdbw Aug 7 '12 at 17:12
• You could also write in the preamble \let\oldappendices\appendices then \def\appendices{\def\theequation{\Alph{chapter}.\arabic{equation}}\oldappendices} which may be "too TeX" and "not enough LaTeX" of an answer... – Alex Nelson Aug 7 '12 at 17:16
• Adding \setcounter{prop}{0}\renewcommand{\theprop}{\Alph{chapter}.\arabic{prop}} solves the proposition numbering problem. Only, why do I have to reset the prop counter?? Without \setcounter the Proposition in the Appendix gets number even though A.2 it's the first proposition in the appendix chapter?? – lpdbw Aug 7 '12 at 18:21

Do it with the appendix package.

\documentclass{book}
\usepackage{amsmath}
\usepackage[toc]{appendix}
\numberwithin{equation}{chapter}
\begin{document}
\chapter{Test Chapter}
\begin{equation}
1+2=3
\end{equation}
\appendix
%\addappheadtotoc
%\appendixpage
\appendixpageoff
\chapter{Appendix}
\begin{equation}
a+b=c
\end{equation}
\end{document} For details run texdoc appendix from command prompt.

• In fact, I do use the appendix package already. I have edited my question to show you what I am actually doing (wanted to keep the example as short as possible). The problem with your solution is that I do not want to have the A after Appendix in the title! I would prefer to let everything as it is and only insert some code which gets me the A into the equation numbers. It's not actually an appendix problem. – lpdbw Aug 7 '12 at 15:44