I'm not that familiar with LaTeX and have a problem with the structure of my document. The table of contents has been created with "\tableofcontents", the appendix with "\appendix" (no further commands for both of them, they are filled completely automatically). In the appendix I have a subsection "MyDocument" which should represent a logically separate document (but actually I want to write in the same tex file). Only the subsection name should appear in the table of contents, not more (normally it would also include one hierarchy layer below). Within this subsection I have three further layers of hierarchy which should be numbered without the appendix prefix "A".
So, the toc should look like this:
1 Chapter
2 Chapter
…
A Appendix
A.1 One appendix
A.2 MyDocument
A.3 Another appendix
The subsection "MyDocument" is placed in a separate tex file (included into appendix) and should look like this (all headings numbered and formatted as headings):
A.2 My Document
1 abc
1.1 hello
1.2 world
1.2.1 world A
1.2.2 world B
2 xyz
Edit: some code
main document
...
\tableofcontents
\include{chapters/chapter1}
\include{chapters/chapter2}
\appendix
\include{general/appendix}
appendix.tex
\section{Appendix}
\input{appendices/one}
\input{appendices/mydocument}
\input{appendices/another}
mydocument.tex
\subsection{My Document}
\subsubsection{abc}
\paragraph{hello}
\paragraph{world}
\subparagraph{world 1}
\subparagraph{world 2}
\subsubsection{xyz}
I found a static solution which is not very comfortable, but ok for my case (I'm mainly interested in the pre-formatted headings, but I don't want the structure of mydocument appear in the table of contents): Remove automated numbering and adding to the toc, use hard-coded numbers instead (probably not a good idea if the structure of this document changes, but in this special case it really is fixed)
\subsubsection*{1. abc}
etc.
Best Answer
I changed the names of the files and the structure slightly, for sake of easyness to provide a solution.
The standard macro
\addcontentsline
is responsible for the generation of ToC entries. If something should not be added to the ToC, but numbered anyway, it's better to kick out the meaning of\addcontentsline
for while insidemydocument.tex
. This is most easily done with a\begingroup...\endgroup
pair right after\subsection{MyDocument}
. Any redefinition of a command or length changes, counter formatting is only done with such a group and does not affect the outside code.Please have a look on the ToC, that
\section{Another appendix}
behaves as usual whereas theMinidocument
subsection has its own counter formatting,but is numbered by default, without hard-coding.Remark If a
book
orreport
class is used,\appendix
behaves best with\chapter
subdivisions, not with\sections
as top level structure units.main.tex -- the main document frame
appendixcontent.tex
mydocument.tex
ToC without using the structure of the faked mini document
Structure of faked document