I am currently preparing the presentation for my internship evaluation. As a French student evaluated by researchers that may or may not speak French, I would like to maintain two versions of my presentation, in French and in English.
I could just create two separate files but I am pretty sure that maintaining both of them would be complicated and that I would most likely forget to port corrections from any version to the other one as well. Thus, my preferred option would be to keep them in the same file (files, in fact: I have taken the habit of having separate files for each section of my documents and \include them all in at the end).
Here is a MWE showing how I managed to do it :
\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[english, french]{babel}
\usepackage{etoolbox}
\usepackage{blindtext}
%\includeonlylecture{english}
%\includeonlylecture{french}
\newcommand{\switch}[1]{%Use with "french" or "english" to switch between languages
%Security check
\ifstrequal{#1}{french}%
{}%
{\ifstrequal{#1}{english}%
{}%
{\PackageError{switch}{Invalid input}{Received "#1" instead of "french" or "english"}}%
}
\lecture{#1}{#1}
\selectlanguage{#1}
\ifstrequal{#1}{french}%
{%
\title{French title}
}%
{\ifstrequal{#1}{english}%
{%
\title{English title}
}%
{}%
}
}
\begin{document}
\switch{english}
\begin{frame}
\titlepage
\end{frame}
\switch{french}
\begin{frame}
\titlepage
\end{frame}
\switch{english}
\begin{frame}{English frame}
\blindtext
\end{frame}
\switch{french}
\begin{frame}{French frame}
\blindtext
\end{frame}
\end{document}
By using \switch with english or french and selecting the desired output language with \includeonlylecture, I managed to only output the corresponding half of the document.
I felt the need to redefine the title at each switch because the theme I use, JuanLesPins, shows the last title specified at the top of each slide.
My question is: is there a cleaner way to do what I'm trying to do, i.e. preparing two consecutive versions of each slide in two different languages and only output one of them?
commentpackage. – Anab Jul 01 '15 at 11:46