# 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. –  Jubobs May 6 '13 at 20:06
Silly question, not very Lyx versed... would that make them not appear in the ToC? I think I need them to appear... –  CMM May 6 '13 at 20:13
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. –  Jubobs May 6 '13 at 20:15

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}
\lipsum[2]

\subsection*{Appendix B}

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