Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to make two seperate table of contents in one report? I want one for the main document and another for the appendices.

I'm writing in the memoir report enviroment.

share|improve this question
    
Where do you want the second toc in relation to the first one? Memoir can do this, though it takes perhaps 5 lines of code. –  daleif Apr 8 '13 at 10:04
5  
Welcome to TeX.sx! This question is very similar to tex.stackexchange.com/questions/42548/…. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. –  lockstep Apr 8 '13 at 10:05
    
That answer would solve the question. –  daleif Apr 8 '13 at 10:07
    
0 down vote accept That question sort of answers mine. But I dont want the appendices to show in the first table of content, and I dont want the "normal" content to show in the second table of content. –  Thea Apr 9 '13 at 10:35
add comment

1 Answer 1

up vote 1 down vote accepted

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.

\documentclass[a4paper]{memoir}
% just to provide sample code
\usepackage{kantlipsum}
\newcounter{tst}
\newcommand\xxx{\stepcounter{tst}\chapter{Test \thetst} \kant[1]}

% disable everything after the POST hook
\cftinsertcode{POST}{
\setcounter{tocdepth}{-1}
}

\newcommand\tableofcontentsapps{
\begingroup
% disable first part
\cftinsertcode{PRE}{
\setcounter{tocdepth}{-10}
}
% enable down to subsection within appendices
\cftinsertcode{POST}{
\setcounter{tocdepth}{2}
}
\renewcommand\contentsname{List of appendices}
\tableofcontents*
\endgroup
}


\begin{document}

\tableofcontents*

\cftinserthook{toc}{PRE}

\xxx\xxx\xxx

\appendix
\appendixpage

\tableofcontentsapps

\cftinserthook{toc}{POST}

\xxx\xxx\xxx


\end{document}
share|improve this answer
    
Thanks for the answer! –  Thea Apr 9 '13 at 11:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.