[Tex/LaTex] Appendices inside a section

appendicessectioning

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.

Best 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}

enter image description here