You can always add a line like:
\addcontentsline{toc}{section}{\protect\numberline{A}{Appendix A}}
and section
gives the format you want. Then the level in the toc
and the format of the heading is independent:
\newcounter{appendix}
\renewcommand\theappendix{\Aleph{appendix}}
\newenvironment{appendix}{%
\refstepcounter{appendix}
\subsection*{Appendix \theappendix}
\addcontentsline{toc}{section}{\protect\numberline{\theappendix}{Appendix \theappendix}}
}{}
I bet there's a package that does this too ;-) Also instead of using \subsection
you could define your own heading with \@startsection
. But that is more involved and probably not necessary.
As for the bibliography, if I understand you correctly, you can do it in the same way:
\phantomsection
\addcontentsline{toc}{section}{References}
\bibliography{mybibliography}
You can use the titletoc
package to produce partial ToCs; a little example:
\documentclass[12pt,a4paper]{article}
\usepackage[titletoc, title]{appendix}
\usepackage{titletoc}
\begin{document}
\tableofcontents\newpage
\listoffigures\newpage
\listoftables\newpage
\begin{appendices}
\section{First Appendix}
\startcontents
\printcontents{}{2}{}
\subsection{subSecA1}
\subsubsection{subsubSecA11}
\subsubsection{subsubSecA12}
\stopcontents
\section{Second Appendix}
\subsection{subSecB1}
\subsubsection{subsubSecB11}
\subsubsection{subsubSecB12}
\end{appendices}
\end{document}
An image of the resulting partial ToC:
Of course, you can customize the partcial ToC in many ways; in the following example I changed the indentation for the entries in the partial ToC using the notion of prefixes and added some rules before and after the partial ToC:
\documentclass[12pt,a4paper]{article}
\usepackage[titletoc, title]{appendix}
\usepackage{titletoc}
\titlecontents{lsubsection}
[2.3em]{}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}{\titlerule*[9pt]{.}\contentspage}
\titlecontents{lsubsubsection}
[5.7em]{}{\contentslabel{3.5em}}
{\hspace*{-3.5em}}{\titlerule*[9pt]{.}\contentspage}
\begin{document}
\tableofcontents\newpage
\listoffigures\newpage
\listoftables\newpage
\begin{appendices}
\section{First Appendix}
\startcontents
\printcontents{l}{2}{\hrulefill}
\vskip-8pt\noindent\hrulefill
\subsection{subSecA1}
\subsubsection{subsubSecA11}
\subsubsection{subsubSecA12}
\subsection{subSecA2}
\subsubsection{subsubSecA21}
\subsubsection{subsubSecA22}
\stopcontents
\section{Second Appendix}
\subsection{subSecB1}
\subsubsection{subsubSecB11}
\subsubsection{subsubSecB12}
\end{appendices}
\end{document}
Using \starlist, \printlist, \stoplist one can also produce partial LoFs and LoTs:
\documentclass[12pt,a4paper]{article}
\usepackage[titletoc, title]{appendix}
\usepackage{titletoc}
\titlecontents{lsubsection}
[2.3em]{}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}{\titlerule*[9pt]{.}\contentspage}
\titlecontents{lsubsubsection}
[5.7em]{}{\contentslabel{3.5em}}
{\hspace*{-3.5em}}{\titlerule*[9pt]{.}\contentspage}
\titlecontents{lfigure}
[2.3em]{}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}{\titlerule*[9pt]{.}\contentspage}
\titlecontents{ltable}
[2.3em]{}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}{\titlerule*[9pt]{.}\contentspage}
\begin{document}
\tableofcontents\newpage
\listoffigures\newpage
\listoftables\newpage
\begin{appendices}
\section{First Appendix}
\startcontents
\startlist{lof}
\startlist{lot}
\printcontents{l}{2}{\hrulefill\par\noindent\textbf{Outline}}
\par\noindent\textbf{List of Figures}
\par\printlist{lof}{l}{}
\par\noindent\textbf{List of Tables}
\par\printlist{lot}{l}{}
\vskip-8pt\noindent\hrulefill
\subsection{subSecA1}
\begin{figure}[!ht]
\centering
\rule{2cm}{2cm}
\caption{A test figure}
\end{figure}
\subsubsection{subsubSecA11}
\begin{table}[!ht]
\centering
\rule{2cm}{2cm}
\caption{A test table}
\end{table}
\subsubsection{subsubSecA12}
\subsection{subSecA2}
\begin{figure}[!ht]
\centering
\rule{2cm}{2cm}
\caption{Another test figure}
\end{figure}
\subsubsection{subsubSecA21}
\begin{table}[!ht]
\centering
\rule{2cm}{2cm}
\caption{Another test table}
\end{table}
\subsubsection{subsubSecA22}
\stopcontents
\stoplist{lof}
\stoplist{lot}
\section{Second Appendix}
\subsection{subSecB1}
\subsubsection{subsubSecB11}
\subsubsection{subsubSecB12}
\end{appendices}
\end{document}
Best Answer
This ought to do it. I included the
Appendices
entry in the first toc as I would think this would be better for users.The idea is to add hooks into the
TOC
file at certain places, such that we can execute code that these places. We then fill in these hooks with code that alter how far down in the toc structure we would like to typeset.