# Multilingual beamer presentations from a single souce?

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)?

-

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{...}

\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}

-
That's nice, but it basically gives me both presentations concatenated (or in two PDFs). Can I get them on different "layers"? The problem I see with two files or two sections is that the source for the multiple versions of one frame get separated. I want to keep all versions of one slide together in the source. – Martin Schröder Jul 27 '11 at 13:14
No, different layers are not supported by PDF I think. You could maybe interleave the slides and make them jump over the following one by default. I would do it as shown in my updated answer, but maybe place the language environments inside the frame. You need to declare them [fragile] then I think, because comment uses verbatim mode. – Martin Scharrer Jul 27 '11 at 13:24
PDF can do layers; tikz can create them (view the microtype docu with Adobe). – Martin Schröder Jul 27 '11 at 13:30
@MartinSchroder: Er ... the jury's out on that. I'd need to see the source of that documentation. Compiling the documentation from the package does not use TikZ/PGF, but then it doesn't produce any diagrams either. However, looking at the source of that document shows that it does have layers and these are implemented by a series of \pdfliteral commands. Search in microtype.dtx for the command \mt@layer. So I don't think that the PDF layers in the microtype documentation are done by TikZ. – Loop Space Jul 27 '11 at 14:06
@Martin (good grief this is confusing! Can one of you please change your name?) The \mt@layer command looks fairly simple and I'm sure it could easily be modified to be used with TikZ. However, I just searched and was having a hard time finding a PDF viewer that could handle these layers, and also it wasn't clear what the point of them was. – Loop Space Jul 27 '11 at 14:08
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7770532965660095, "perplexity": 1528.005210284669}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-48/segments/1448398446535.72/warc/CC-MAIN-20151124205406-00194-ip-10-71-132-137.ec2.internal.warc.gz"}