# “section level” appendices

I am writing my thesis using a document class that has chapters and then sections under them. Because the chapters are about pretty unrelated topics, I'd like to put the appendices at the end of each chapter (at section level) that they belong (instead of having all the appendices at the end).

One way that I found that mostly worked was to put this in front of each of the appendices

\newcounter{ninjalevel}
\setcounter{ninjalevel}{1}

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


and then reset \theequation and \thesection after the appendices. But I have to do this for each chapter and it's kind of clumsy. Are there better ways?

Btw, I am not even sure if this is the right terminology. Can you have appendices not at the end of the documents, or should they be called something else? Thanks!

-

The subappendices environment of the appendix package pretty much does what you want. In addition, use the chngcntr package to couple the equation counter to the section level.

\documentclass{report}

\usepackage{appendix}

\usepackage{chngcntr}
\counterwithin{equation}{section}

\begin{document}

\chapter{foo}

\section{foofirst}

$$a^2 + b^2 = c^2$$

\begin{subappendices}

\section{foofirstappendix}

$$d^2 + e^2 = f^2$$

\end{subappendices}

\chapter{bar}

\section{barfirst}

$$g^2 + h^2 = i^2$$

\end{document}

-
Awesome, thanks so much! – ceiling cat Jul 12 '11 at 5:53