# Two column layout with bilingual two tables of contents for each language

Using texlive on Debian Jessie

I am writing my application for a position and would like to include versions of the content in both German and English.

I would like to have a page right after the cover of my application which contains two ToCs next to each other however each displaying things that are only in the specified language.

So far I have found out how to add two ToC like this:

\usepackage{parcolumns}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\pc@placeboxes}{\vrule}{{\VRULE}}{}{}
\makeatother
\newcommand\VRULE{\color{SOME_COLOR}\vrule width 0.2mm}
\usepackage{shorttoc}
...

\begin{parcolumns}[nofirstindent,rulebetween=true]{2}
\colchunk{
\selectlanguage{german}
\shorttableofcontents{\contentsname}{1}
}
\colchunk{
\selectlanguage{english}
\tableofcontents
}
\end{parcolumns}
\pagebreak


This produces the following:

As you can see things are far from done. I'm not that much into the LaTeX gimmicks so I have no idea if what I'm about to ask for is even possible.

The first question is: Is it possible to customize a ToC to show only entries the fulfil a specific condition? In my case the condition would be: is the section name in German or in English? If it's in German than show only in the left ToC else if in English show only in the right ToC. In addition it would be amazing if an entry can have both conditions fulfilled so that it can appear in both ToCs (for example a certificate that I don't have the translation for and there is no need to add it twice just for kicks). I would imagine all the above would work with some sort of if and adding some sort of a value for German and English sections that is then checked and based on it ToC is populated accordingly.

Continuing this line of thought and if you are familiar with both languages you might have noticed in the image above that the entries 1 and 2 mean the same (but in a different language) as well as the entries 3 and 4.

This leads me to the second question namely: Is it possible to use some sort of condition that would allow two sections to have the same number?

At the end here is what the page should look like:

EDIT: Thanks to the amazing @ChristianHupfer it's almost done! One last problem is the removal of the blank entries in the toc that doesn't have entry X,Y and Z but ftoc has them:

The image above corresponds to the code below:

\section{Lebenslauf}
\pagebreak
\section{Lebenslauf}[CV]*
\pagebreak
\section{Bachelor Urkunde}
\pagebreak
\section{Bachelor Urkunde}[Bachelor Diploma]*
\pagebreak
\section{Lalalala}[Lalalala]
\pagebreak
\section{Wichtige Informationen}
\pagebreak
\section{Wichtige Informationen}[Important information]*
\pagebreak
\section{Andere Informationen}
\pagebreak
\section{Noch mehr wichtige Informationen}
\pagebreak
\section{Noch mehr wichtige Informationen}[Even more important information]*
\pagebreak
\section{Blabla}[Only in English Foo]*
\pagebreak
\section{Zusammengef\"uhrt}[Recombined]


I have the feeling that I might not have explained things well enough (sorry about that!) - a section in a different language actually has to appear as a separate section. So the code above suits my needs best with the small visual annoyance that blank entries are left in the both tocs. Is it possible to remove these? It's not such a big deal but I believe that things would look much better especially for other readers of this whole topic who want to use the solution(s) provided in a larger document where multiple entries can appear in just one of both tocs leaving huge blank spaces in the other toc.

• It is possible, but I believe that having two separate ToCs that do not interfere with each other is the better (easier???) solution. Are you using the article class? – user31729 Mar 21 '16 at 17:40
• Yes, I am using article. As for the two separate ToCs can you perhaps point me to a place where I can see how it's done? I have the feeling that this won't change the problem with the conditional addition of entries. Or am I wrong? – rbaleksandar Mar 21 '16 at 17:49

Here is a version with an additional optional argument to \section that holds the English version of the section name for the table of content. If the [...] is omitted, nothing is entered to the ftoc (meaning foreign toc).

Use \tableofcontents for the traditional behaviour and \tableofcontents[ftoc] for the other language. The language settings are actually done in the parcolumns environment, not within \tableofcontents etc.

\documentclass{article}

\usepackage[english,ngerman]{babel}
\usepackage{xpatch}
\usepackage{xparse}

\usepackage{parcolumns}

\makeatletter

\patchcmd{\pc@placeboxes}{\vrule}{{\VRULE}}{}{}
\newcommand\VRULE{\color{SOME_COLOR}\vrule width 0.2mm}

\let\latex@@section\section
\RenewDocumentCommand{\section}{somo}{%
\IfBooleanTF{#1}{%
\latex@@section*{#3}%
}{%
\IfValueTF{#2}{%
\latex@@section[#2]{#3}%
}{%
\latex@@section{#3}%
}%
\IfValueT{#4}{%
}%
}%
}

\renewcommand\tableofcontents[1][toc]{%
\section*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{#1}%
}

\makeatother

\begin{document}

\begin{parcolumns}[nofirstindent,rulebetween=true]{2}
\colchunk{
\selectlanguage{ngerman}
\tableofcontents
%\shorttableofcontents{\contentsname}{1}
}
\colchunk{
\selectlanguage{english}
\tableofcontents[ftoc]
}
\end{parcolumns}
\pagebreak

\section{Lebenslauf}[CV]
\section{Bachelor Urkunde}[Bachelor Diploma]
\section{Wichtige Informationen}[Important information]

\end{document}


Update

\documentclass{article}

\usepackage[english,ngerman]{babel}
\usepackage{xpatch}
\usepackage{xparse}

\usepackage{parcolumns}

\makeatletter

\patchcmd{\pc@placeboxes}{\vrule}{{\VRULE}}{}{}
\newcommand\VRULE{\color{SOME_COLOR}\vrule width 0.2mm}

\newcounter{storetocdepth}

\let\latex@@section\section
\RenewDocumentCommand{\section}{somos}{%
\IfBooleanTF{#1}{%
\latex@@section*{#3}%
}{%
\IfBooleanTF{#5}{%
\setcounter{storetocdepth}{\value{tocdepth}}
% The #2 is of no use here, except of page headings /section mark
\IfValueTF{#2}{%
\latex@@section[#2]{#3}%
}{%
\latex@@section{#3}%
}%
\addtocontents{toc}{\protect\contentsline{section}{\protect\phantom{#3}}{}}% Provide an empty fake entry
}{%
\IfValueTF{#2}{%
\latex@@section[#2]{#3}%
}{%
\latex@@section{#3}%
}%
}%
\IfValueTF{#4}{%
}{%
\addtocontents{ftoc}{\protect\contentsline{section}{\protect\phantom{#2}}{}}% Provide an empty fake entry
}%
}%
}

\renewcommand\tableofcontents[1][toc]{%
\section*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\@starttoc{#1}%
}

\makeatother

\begin{document}

\begin{parcolumns}[nofirstindent,rulebetween=true]{2}
\colchunk{
\selectlanguage{ngerman}
\tableofcontents
%\shorttableofcontents{\contentsname}{1}
}
\colchunk{
\selectlanguage{english}
\tableofcontents[ftoc]
}
\end{parcolumns}
\pagebreak

\section{Lebenslauf}[CV]
\section{Bachelor Urkunde}[Bachelor Diploma]
\section{Wichtige Informationen}[Important information]
\section{Andere Informationen}
\section{Noch mehr wichtige Informationen}[Even more important information]
\section{Blabla}[Only in English Foo]*

\section{Zusammengef\"uhrt}[Recombined]

\end{document}


• Thanks for the reply. I've created a new empty TEX document where I pasted your code but it's not working as you've described. If [...] is empty I still get an entry in the ftoc but without the name (just the index plus the starting page). I should mention that I'm using texlive on Debian Jessie (will update my post to include this vital info). Maybe the problems is due to the TeX version I'm using... – rbaleksandar Mar 21 '16 at 18:18
• @rbaleksandar: I don't understand. Do not use [], just omit it! – user31729 Mar 21 '16 at 18:20
• facepalm Will give it a go. :D – rbaleksandar Mar 21 '16 at 18:21
• @rbaleksandar: The problem with an omitted entry is that the numbers will jump from, say, 3 to 5 and the lines might get out of joint – user31729 Mar 21 '16 at 18:23
• Question:what if I want an entry in the ftoc but not in the toc?Currently only the one way is working.For example I have a CV in both German and English.In one section I want to have the "Lebenslauf" and after that in another-the "CV".If I do \section{Lebenslauf}(contains the German version) followed by \section{Lebenslauf}[CV](contains the English version) I get two "Lebenslauf" in the German ToC and a single "CV" in the English ToC.It should be one on one.Take a look at the second image with the desired result and notice the pages in both ToC for the first entry - they are different. – rbaleksandar Mar 21 '16 at 18:24