[Tex/LaTex] Contents page in two different languages

babelsectioningtable of contents

I'm currently writing a report where all of my titles are in French and hence my table of contents is also in French. I however need to also include a contents table in English and I was wondering if there was any way of adding in a section title in the other language to automatically produce an additional contents page?

For example is I wanted to use these two titles for one single section…

\section{Méthodes et matériaux}
\section{Methods and materials}

I know it might not be something that's often done but if anyone has any suggestions it would be fantastic. If you need me to provide any other information, please don't hesitate to ask.

Best Answer

Replicate what \tableofcontents does. For defining the English titles you have to type them just below the French one, with the macro \addtoetoc

\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french]{babel}

\makeatletter
\newcommand\englishtableofcontents{%
  \if@twocolumn
    \@restonecoltrue\onecolumn
  \else
    \@restonecolfalse
  \fi
  \begin{otherlanguage}{english}
  \chapter*{%
    \contentsname
    \@mkboth{\MakeUppercase\contentsname}
            {\MakeUppercase\contentsname}%
  }%
  \@starttoc{tec}%
  \end{otherlanguage}
  \if@restonecol\twocolumn\fi
}
\newcommand{\addetoc}[2]{%
  \addcontentsline{tec}{#1}{\protect\numberline{\csname the#1\endcsname}#2}%
}
\makeatother

\begin{document}
\frontmatter
\tableofcontents
\englishtableofcontents

\mainmatter
\chapter{Introduction}
\addetoc{chapter}{Introduction}

\section{Méthodes et matériaux}
\addetoc{section}{Methods and materials}

\end{document}

Here is page i from the example:

enter image description here

and here is page iii:

enter image description here


Here's a complete version for the article class, where we can exploit the fact that the list commands are defined in a very similar way:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,french]{babel}

\usepackage{etoolbox,pdftexcmds}
\let\englishtableofcontents\tableofcontents
\patchcmd\englishtableofcontents{{toc}}{{tec}}{}{}
\preto\englishtableofcontents{\begin{otherlanguage}{english}}
\appto\englishtableofcontents{\end{otherlanguage}}
\let\englishlistoffigures\listoffigures
\patchcmd\englishlistoffigures{{lof}}{{lef}}{}{}
\preto\englishlistoffigures{\begin{otherlanguage}{english}}
\appto\englishlistoffigures{\end{otherlanguage}}
\let\englishlistoftables\listoftables
\patchcmd\englishlistoftables{{lot}}{{let}}{}{}
\preto\englishlistoftables{\begin{otherlanguage}{english}}
\appto\englishlistoftables{\end{otherlanguage}}

\newcommand{\addetoc}[2]{%
  \addcontentsline{tec}{#1}{\protect\numberline{\csname the#1\endcsname}#2}%
}
\makeatletter
\newcommand{\englishcaption}[1]{%
  \ifnum\pdf@strcmp{\@captype}{figure}=\z@
    \addcontentsline{lef}{figure}{\protect\numberline{\thefigure}#1}%
  \else
    \addcontentsline{let}{table}{\protect\numberline{\thetable}#1}%
  \fi
}
\makeatother

\begin{document}

\tableofcontents
\englishtableofcontents

\listoffigures
\englishlistoffigures

\listoftables
\englishlistoftables

\section{Méthodes et matériaux}
\addetoc{section}{Methods and materials}

\subsection{Méthodes}
\addetoc{subsection}{Methods}

\begin{figure}[htp]
\centering{something}
\caption{En français}
\englishcaption{In English}
\end{figure}

\subsection{Matériaux}
\addetoc{subsection}{Materials}

\begin{table}[htp]
\centering{something}
\caption{En français}
\englishcaption{In English}
\end{table}

\end{document}

enter image description here

Related Question