GeneralMultiple Table of Contents

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
nashay
Posts: 8
Joined: Thu Jul 16, 2009 9:20 am

Multiple Table of Contents

Post by nashay »

I am making a document that includes two languages. I want to make two seperate tables of contents (one for each language)

Is there an easy way to do this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Multiple Table of Contents

Post by gmedina »

Hi,

one option would be to use some of the features provided by the tocloft package (please, refer to the package documentation for further information). The following example uses the standard \tableofcontents command to create a table of contents in English and illustrates how to proceed to also produce a table of contents in Spanish (the code contains some explanatory comments):

Code: Select all

\documentclass{book}
\usepackage[spanish,english]{babel}
\usepackage{tocloft}

\newcommand{\nombreindice}{\'Indice General}
\newlistof{indice}{tce}{\nombreindice}

% definition of the commands used for the Spanish ToC;
% \captce for chapters, \sectce for sections and
% \ssectce for subsections
\newcommand\captce[1]{%
  \addcontentsline{tce}{chapter}{\protect\makebox[1.3em][l]{\thechapter}#1}}
\newcommand\sectce[1]{%
  \addcontentsline{tce}{section}{\protect\makebox[2.8em][l]{\thesection}#1}}
\newcommand\ssectce[1]{%
\addcontentsline{tce}{subsection}{\protect\makebox[3em][l]{\thesubsection}#1}}

\begin{document}
\tableofcontents
\clearpage
\listofindice
\clearpage

\chapter{Test chapter one}
\captce{Cap\'itulo de prueba uno}

\section{Test section one one}
\sectce{Secci\'on de prueba uno uno}

\section{Test section one two}
\sectce{Secci\'on de prueba uno dos}

\subsection{Test subsection one two one}
\ssectce{Subsecci\'on de prueba uno dos uno}

\chapter{Test chapter two}
\captce{Cap\'itulo de prueba dos}

\section{Test section two one}
\sectce{Secci\'on de prueba dos uno}

\subsection{Test subsection two one one}
\ssectce{Subsecci\'on de prueba dos uno uno}

\subsection{Test subsection two one two}
\ssectce{Subsecci\'on de prueba dos uno dos}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
nashay
Posts: 8
Joined: Thu Jul 16, 2009 9:20 am

Re: Multiple Table of Contents

Post by nashay »

Thanks  :)
testificate
Posts: 1
Joined: Wed Jun 18, 2014 10:01 pm

Re: Multiple Table of Contents

Post by testificate »

Hello - I was having this exact same problem and I stumbled upon your answer and it worked brilliantly (I just had to rename the commands and change the title name to their Romanian equivalents). Thank you very much!
man_niek
Posts: 4
Joined: Sat Apr 30, 2016 11:38 am

Multiple Table of Contents

Post by man_niek »

Hello,

This works, but how do you add \chapter*{Introduction} (unnumbered) to this second list?

greetings
man_niek
Posts: 4
Joined: Sat Apr 30, 2016 11:38 am

Multiple Table of Contents

Post by man_niek »

I known!

\addcontentsline{tce}{chapter}{Introduction} :-)
Post Reply