# Appendices inside a section?

How can create appendices "numbered" A, B, C within three different sections of a Lyx article document. In other words, I would like Appendix A to be at the the end of my first section, Appendix B to be at the end of my second Section, etc. I tried to use the Document ------> Start Appendix Here, but then I can't continue with the sections.

• You should used an unnumbered section if you want that (\section*{Appendix A}). No more numerated stuff is expected after \appendix – Mario S. E. May 6 '13 at 20:05
• Oh, and Welcome to TeX.sx! :) – Mario S. E. May 6 '13 at 20:06
• Usually, appendices are common \chapters placed after the \appendix command in your input file, and you can't have a chapter inside a section. You have to respect the hierarchy of sectioning commands. Mario S. E.'s advice is sound, but perhaps you want to use \subsection*{Appendix A} if the "appendix" in question must be inside a section. – jub0bs May 6 '13 at 20:06
• You can use \subsection*{Appendix A} \addcontentsline{toc}{subsection}{Appendix A}. The second command will add the unnumbered subsection in your ToC. You should get familiar with the sectioning commands. Follow the link in my ealier comment. – jub0bs May 6 '13 at 20:15
• Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you :) – jub0bs May 6 '13 at 22:12

## 1 Answer

Usually, appendices are common \chapters placed after the \appendix command in your input file, and you can't have a chapter inside a section; you have to respect the hierarchy of sectioning commands. Follow this link to get more familiar with the sectioning commands.

In order to get headings such as "Appendix A", "Appendix B", etc. within a section, you could use the next level of depth of sectioning commands, i.e. subsections. Use the starred version to get an unnumbered subsection:

\subsection*{Appendix A}


However, in most classes--notable exceptions include amsart; see Ryan Reich's comment below--this will not produce any entry in your ToC, even if you have set the depth of your ToC to subsection level, using \setcounter{tocdepth}{2} (or higher). You must add the entry for that unnumbered subsection "manually", using

\addcontentsline{toc}{subsection}{Appendix A}


In summary:

\documentclass{article}

\usepackage{lipsum}     % dummy text
\setcounter{tocdepth}{2}

\begin{document}

\tableofcontents

\section{Foo}

\lipsum[1]

\subsection*{Appendix A}
\addcontentsline{toc}{subsection}{Appendix A}
\lipsum[2]

\subsection*{Appendix B}
\addcontentsline{toc}{subsection}{Appendix B}
\lipsum[3]

\end{document}


• Cool. Let’s if it will be closed anyhow. – Speravir May 6 '13 at 21:19
• @Speravir Having appendices in a section seems outlandish but, who knows? Maybe my answer will help others... – jub0bs May 6 '13 at 21:21
• Yes, I think the same. – Speravir May 6 '13 at 21:22
• Note that some classes do include unnumbered \subsection*'s, most notably (to me) the amsart class. For that one you should not use \addcontentsline; to remove an unwanted one, see barbara beeton's answer. – Ryan Reich May 6 '13 at 22:16
• @RyanReich Thanks I didn't know. I've never used such classes. I'll edit my answer. – jub0bs May 6 '13 at 22:18