I want to create a LaTeX beamer presentation within multiple languages in the following sense:
The sorce code should contain the different languages, but the language of the compiled result should depend on a specific choice of one language.
A solution has already been provided https://tex.stackexchange.com/a/31401/21166. However the \sectionlang
command seems to have problems, when using beamer LaTeX with \input
.
There is no error displayed, but the command are ignored during compilation.
Everyting works fine in the following code example (the package multilanguage
is from the link above)
\documentclass{beamer}
\usepackage[ngerman,english]{babel}
\usepackage{ifthen}
\usepackage{multilanguage}
\setdoclang{en}{english}
% \setdoclang{de}{ngerman}
\begin{document}
\frame{
\tableofcontents
}
\sectionlang{en}{Section 1}
\sectionlang{de}{Abschnitt 1}
\frame{
\lang{de}{Folie 1}
\lang{en}{Slide 1}
}
%\mode<all>
%\input{./frame.tex}
%\mode*
%\againframe<1>{slide2}
\sectionlang{en}{Section 2}
\sectionlang{de}{Abschnitt 2}
\frame{
\lang{en}{Slide 3}
\lang{de}{Folie 3}
}
\end{document}
The frame.tex file contains
\frame<0>[label=slide2]
{\frametitle{\lang{de}{Folie 2}
\lang{en}{Slide 2}}
\lang{de}{Folie 2}
\lang{en}{Slide 2}
}
However, when the \input
block in uncommented, the compiled ToC does not contain Section 2 anymore.
Best Answer
Update:
I think the best way would be to build two
tex
files, one for each needed language. Then the TOC, hyphenation and so on are working as usual. Of course the disadvantage is that you have to change two (or more) files, depending on the number of used languages.An alternative way could be to use package
ifthenelse
, define boolean variables for the used languages and include each frame in a construct like:That should help you to keep all languages in one file.
Old answer:
Just to give you a hint how to procede please have a look on the following MWE. The package
filecontents
is used to write a changed package filemultilanguage.sty
.I have added the line
\newcommand{\frametitlelang}[2]{\lang{#1}{\frametitle{#2}}}
to have a new macro\frametitlelang
. This macro is used to build the frame title depending on the language.