Generaldouble language tex file

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mrmag
Posts: 14
Joined: Mon Jul 21, 2008 1:55 pm

double language tex file

Post by mrmag »

Hello Latex-community,

I’m writing an article in Tex in two languages. The content of information of the both languages is the same. Is it possible to organize the structure of tex file so that I’ll be able to store two-language text in one file? The compilation of the tex file in one of two languages will be managed by some property fileld.

Thank you in advance!

Recommended reading 2024:

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

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

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

double language tex file

Post by gmedina »

Hi,

you can use babel with as many idiomatic options as you like (the last language declared will be the main one (english, in my example)) and use the \selectlanguage command to change the current language,as the following example suggests:

Code: Select all

\documentclass{article}
\usepackage[ngerman,english]{babel}
\usepackage{blindtext}

\begin{document}
\section{English text}
\blindtext

\selectlanguage{ngerman}
\section{German text}
\blindtext

\selectlanguage{english}
\section{Some more English text}
\blindtext

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
mrmag
Posts: 14
Joined: Mon Jul 21, 2008 1:55 pm

Re: double language tex file

Post by mrmag »

Unfortunately, this is not that I want. For example, I write one paragraph in one language and right the same paragraph but in another language below it.

%german
\section{Erste Sektion}
Das bin ich…

%english
\section{First section}
This is me…

It must be also some property which I can change in preamble and which indicate what language will be compiled. So that, one can select only one language for compilation!
mrmag
Posts: 14
Joined: Mon Jul 21, 2008 1:55 pm

Re: double language tex file

Post by mrmag »

It’s quite similar to the \mode construction in beamer class.

\mode<presentation>

\mode
<all>
{
%do for both presentation and article
}

\mode
<article>
{
%do something for article
}

\mode
<presentation>
{
%do something for presentation
}

Unfortunately, this \mode feature is defined only in beamer. \mode<presentation> shows that the tex file must be compiled in presentation mode. As article and presentation could be both of the languages. Is there similar construction in LaTex?
Post Reply