# Template: bilingual document

Recently I received an email with the question for a bilingual document. I never had to write a bilingual document before, and the challenge was there. What I create is a two column document in which two languages can be used: one in the left column and one in the right column. I tried to keep things as simple and clean looking as possible.

The template makes use of the article documentclass. Two packages are important: babel and parallel. The first is used to select the languages for the main content and the second package is needed to create the two column layout.

## The babel package

The babel package should be well-known to you. In this template, it is called as follows:

\usepackage[english,german]{babel}

Hence, the english en german languages are loaded. In the main content of the template, the languages are selected with the selectlanguage command. For example, the english language is selected with

\selectlanguage{english}

## The parallel package

The parallel package is used to create a two column layout, where each columns contains text in a different language. For english in the left and german in the right column, we do:

 \selectlanguage{english} \ParallelLText{\blindtext} \selectlanguage{german} \ParallelRText{\blindtext}

The parallel package also makes sure that, when a paragraph in one language is shorter than the other, the next paragraph begins at the same line for both languages. In order to say to LaTeX that a paragraph is ended, we type

\ParallelPar

## Line numbering

As a final decoration, line numbering is added to the document. This is done because I often see it in bilingual documents. It is achieved with the lineno package. In the preamble, after \usepackage{lineno}, add \linenumbers.

1. Oliver says:

WOW! This is a topic I was looking for a very long time!
For some time, I used struggle with a TeX trick:
 %%% load the package {ifthen}

 %%% The TeX code to generate the language commands. \def\localedef#1#2{ \ifthenelse{ \equal{\locale}{#1} }{ \selectlanguage{#2} \expandafter\def\csname#1\endcsname ##1{##1} }{ \expandafter\def\csname#1\endcsname ##1{} } } %%% Selected language. Can be placed anywhere before the language commands. \providecommand\locale{en} \providecommand\locale{fr} %%% Define languages selction macros \localedef{de}{ngerman} \localedef{en}{english} \localedef{fr}{frenchb} %%% To select a language: enclose the text in the lang: \de{Guten Tag} \fr{Bonjour} \en{Good day} 

%%% compile with: latex 'providecommand\locale{en}\input{mydocument-main.tex}' 

Unfortunally, the latter seemed to not work in every case (e.g. some packages conflicts), so I went back to my old ways and un/comment input files…

2. vchalmel says:

Hello, does this package allow to define chapters with one entry in the ToC but two chapter names on the two columns ?

3. error says:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
restricted \write18 enabled.
entering extended mode
(./e3.tex
LaTeX2e
Babel and hyphenation patterns for 7 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
(/usr/share/texlive/texmf-dist/tex/generic/babel-english/english.ldf
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def))

! Package babel Error: Unknown option german’. Either you misspelled it
.

See the babel package documentation for explanation.
Type H for immediate help.

l.296 \ProcessOptions*

? x

4. I think this is among the most significant info for me. And
i’m happy studying your article. But want to statement on some normal things, The website taste
is wonderful, the articlees is truly great :
D. Excellent job, cheers

5. Woah! I’m really enjoying the template/theme of this site.
It’s simple, yeet effective. A lot of times it’s very difficult to get that “perfect balance” between usability
and visual appearance. I must say you have dopne a very good job with this.

Superb Blog!

6. Is it possible to create a two-column Word document, where each column shows a different file?

• Frits says:

I wouldn’t know about that. This blog is about LaTeX, not MS Word.

7. escudito says:

Nice idea, thank you.

If you ever plan to use color in your document, though, you should think of replacing the Parallel package with the pdfcolparallel package (\usepackage{pdfparallel}). It is a respectful fork of Parallel that handles the color stack better.

When I use parallel or pdfparallel I usually define this macros:


So later I can use them in my documents this way:

 \rus{Здравствуйте!} \esp{¡Salud!} `