Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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}

\begin{equation}
a^2 + b^2 = c^2
\end{equation}

\begin{subappendices}

\section{foofirstappendix}

\begin{equation}
d^2 + e^2 = f^2
\end{equation}

\end{subappendices}

\chapter{bar}

\section{barfirst}

\begin{equation}
g^2 + h^2 = i^2
\end{equation}

\end{document}
share|improve this answer
    
Awesome, thanks so much! –  ceiling cat Jul 12 '11 at 5:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.