If I have a document with multiple tables of contents, can I limit the scope of a toc sections are added and reset the toc?


I have a document made up of 10 languages. (using \input{en}, \input{de}, \input{da} etc.) There are 11 tables of contents:

  • Language Directory (composed of each \input (probably going to have to just be a custom table containing hooks for each \input. I don't know how I will implement this yet.
  • Local table of contents for each specific language (10 languages)

Example Code

Example of Main .tex

\maketableofcontents % language directory (list of inputs with language names)

Example of en.tex

\maketableofcontents % local toc
%\somecommand % TOC scope limit

Example of de.tex

\maketableofcontents % local toc
%\somecommand % TOC scope limit

Example of da.tex

\maketableofcontents % local toc
%\somecommand % TOC scope limit
  • if you place it the in the main file as: {\maketableocontents \input{en}} does this create the desired effect? – Rick de Groot Feb 19 '15 at 10:27
  • The package tableof has dedicated commands for that – Denis Feb 19 '15 at 10:43
  • 1
    etoc provides means for this – user31729 Feb 19 '15 at 12:02

Here's a solution using etoc. Note the limitations of the default filecontents environment


% Use this version \newlang{<name>}{<file>}
% to use external files
  \renewcommand\contentsname{#1 Contents}%

\renewcommand\contentsname{Language directory}

% Or use 
% if you prefer the second macro


  • I am not sure I understand why \newlang{german} comes after \newlangfile{english}{en.tex}, but before \localtableofcontents. English should have a local TOC and so should German. – Jonathan Komar Feb 19 '15 at 13:55
  • 1
    The macro \newlangfile{english}{en.tex} does the same as newlang, but additionally \inputs a file (provided by the second argument). This allows you to keep a main file similar to your example using \input. Furthermore, I've edited the macro definition to change the Title of every local toc to show that every language has its own toc. – Patrick Happel Feb 19 '15 at 14:05
  • Awesome! Really, really cool stuff right there...Realistically the \contentsname will be set differently, but still, the other possibility of creating a language switch within \newlangfile is great. – Jonathan Komar Feb 19 '15 at 14:13
  • I see you are creating toc parts that contain the language names. Is there a way to bring those parts together in a language directory? Also, it would be nice to have those parts show up in the PDF bookmarks. I am not sure at the moment whether that is a job for tocloft or etoc. – Jonathan Komar Feb 19 '15 at 14:17
  • Ok, it was easy to get the language directory. I just had to temporarily do a \setcounter{tocdepth}{0}. It would be cool to get the parts into the bookmarks. I think this stuff is beyond the scope of the question, however. – Jonathan Komar Feb 19 '15 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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