Text FormattingTwo language on facing pages

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
kernowsteve
Posts: 3
Joined: Mon Aug 02, 2010 11:21 am

Two language on facing pages

Post by kernowsteve »

Hi all,

I've got two text files in two different languages, and need to interleave them so that each facing page contains the same block of text, English on the left and the other language on the right. Is there an easy (or even a medium-difficulty!) way to achieve this with LaTeX please?

TIA,

Steve.
Last edited by kernowsteve on Mon Aug 02, 2010 12:54 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two language on facing pages

Post by localghost »

Definitely a job for the parallel package.

Code: Select all

\documentclass[11pt,a4paper,titlepage,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}
\usepackage{parallel}

\title{Two languages on facing pages}
\author{kernowsteve}

\begin{document}
  \maketitle
  \begin{Parallel}[p]{}{}
    \ParallelLText{%
%      \selectlanguage{english}
      \blinddocument
    }
    \ParallelRText{%
      \selectlanguage{ngerman}
      \blinddocument
    }
  \end{Parallel}
\end{document}

Best regards and welcome to the board
Thorsten
kernowsteve
Posts: 3
Joined: Mon Aug 02, 2010 11:21 am

Re: Two language on facing pages

Post by kernowsteve »

Thanks Thorsten, that looks great. Is it possible to \import the entire two language files using the parallel package, or is it necessary to do it page by page?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two language on facing pages

Post by localghost »

kernowsteve wrote:[...] Is it possible to \import the entire two language files using the parallel package, or is it necessary to do it page by page?
I'm afraid I can't follow you. There are no language files imported and I don't understand what you mean with »page by page« in this context.
kernowsteve
Posts: 3
Joined: Mon Aug 02, 2010 11:21 am

Re: Two language on facing pages

Post by kernowsteve »

Sorry if I wasn't clear. I meant to ask: with the parallel package, can I enter all the text in one language (the whole book) in one block, then all of the other language in a block, or is it necessary to enter individual left-right paragraph pairs for the entire book?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Two language on facing pages

Post by localghost »

I thought that I have shown that with the example in my last reply. There are two entire documents in two different languages. So from my understanding you can typeset a whole document on each side. What I have forgotten is to reset the »section« counter in the foreign language part.

Code: Select all

\documentclass[11pt,a4paper,titlepage,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}
\usepackage{parallel}

\title{Two languages on facing pages}
\author{kernowsteve}

\begin{document}
  \maketitle
  \begin{Parallel}[p]{}{}
    \ParallelLText{%
%      \selectlanguage{english}
      \blinddocument
    }
    \ParallelRText{%
      \setcounter{section}{0}
      \selectlanguage{ngerman}
      \blinddocument
    }
  \end{Parallel}
\end{document}
But during further tests I faced some problems with typesetting on facing pages. They are shown in the below code.

Code: Select all

\documentclass[11pt,a4paper,titlepage,twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}
\usepackage{parallel}

\title{Two languages on facing pages}
\author{kernowsteve}

\begin{document}
  \maketitle
  \begin{Parallel}[p]{}{}
    \ParallelLText{%
%      \selectlanguage{english}
      \blindtext
    }
    \ParallelRText{%
      \selectlanguage{ngerman}
      \blindtext[2]
    }
    \ParallelPar
  \end{Parallel}
\end{document}
Obviously a misbehaviour of the package and worth a note to the author. The package seems to be still in beta status (for seven years now!). Perhaps the author is not planning further development.
Post Reply