[Tex/LaTex] Multilingual beamer presentations from a single souce

beamerconditionalslanguages

I have a beamer presentation of which I have two language versions (german and english), more languages are upcoming. I keep both versions in one source and select the one to typeset with the comment package. But this gives me only a presentation with one language.

Can I create a presentation with multiple languages that allows me to switch between them on the fly (either per presentation or per slide)?

Best Answer

Beamer supports an appendix with optional slides which can be jumped to using navigation items. You might have all slides of the default language first, then and end slide (maybe blank) and then as an appendix all slides of the second language. You could add navigation buttons from every slide to its translated slide and vice-versa, which allows you to jump between them easily. Also if you want to have the whole presentation in the second language simply start from the first slide of the appendix. This should also work in principle with more than two languages, but with increased complexity.

Note that you also can jump from one PDF to another one. So you could have two PDFs and add hyperlinks to the same page of the other PDF. See in the hyperref manual the section about \href[page=..]. The zref-abspos package provides you with the required absolute page number. You also need to choice the correct view for the link (fullscreen).

I made the following proof-of-concept file which works fine for me. I can jump to the translated version of the current slide, both in normal and fullscreen mode. This uses two PDFs.

% presentation-en.tex
% the main file
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english,ngerman]{babel}

\usepackage{comment}
\ifdefined\GERMAN
% Exchange for German version
\includecomment{german}
\excludecomment{english}
\else
\excludecomment{german}
\includecomment{english}
\fi

\makeatletter
\makeatother

% Needs: etc.
% \setlanguage{...}

\setbeamertemplate{navigation symbols}{\langnav}

\begin{german}
\newcommand{\langnav}{%
    \href[page=\value{page}]{presentation-en}{{\tiny EN}}
}
\selectlanguage{ngerman}
\end{german}
\begin{english}
\newcommand{\langnav}{%
    \href[page=\value{page}]{presentation-de}{{\tiny DE}}
}
\selectlanguage{english}
\end{english}


\begin{document}

\begin{german}
\begin{frame}{Apfelbäume}
   Diese Präsentation ist über Apfelbäume.

\end{frame}
\end{german}

\begin{english}
\begin{frame}{Apple trees}
    This presentation is about apple trees.

\end{frame}
\end{english}

\begin{german}
\begin{frame}{Äpfel sind lecker}
    Sehr sehr lecker!
   \only<2>{Man kann es gar nicht glauben!}

\end{frame}
\end{german}

\begin{english}
\begin{frame}{Apples are tasty!}
   So tasty!
   \only<2>{Can you believe it!}

\end{frame}
\end{english}

\end{document}
% presentation-de.tex
\def\GERMAN{}
\input{presentation-en}
Related Question