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.
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}
-
-
@Speravir Having appendices in a section seems outlandish but, who knows? Maybe my answer will help others...– jub0bsMay 6, 2013 at 21:21
-
-
Note that some classes do include unnumbered
\subsection*
's, most notably (to me) theamsart
class. For that one you should not use\addcontentsline
; to remove an unwanted one, see barbara beeton's answer. May 6, 2013 at 22:16 -
@RyanReich Thanks I didn't know. I've never used such classes. I'll edit my answer.– jub0bsMay 6, 2013 at 22:18
\section*{Appendix A}
). No more numerated stuff is expected after\appendix
\chapter
s 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.\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.