I'd like to generate beamer slides matching the main language of the target audience. The easiest way seems to facilitate the comment
package and pack the individual slides into includecomment
/excludecomment
environments... (as suggested in a previous question).
However this breaks in various ways when non-ascii characters are involved depending on the location and character (and even document class) used, for example:
./comment.cut:2: Package inputenc Error: Keyboard character used is undefined
./comment.cut:1: Argument of \UTFviii@three@octets has an extra }.
./comment.cut:3: Package inputenc Error: Unicode char \Uffffffffifnum (U+2E7) not set up for use with LaTeX.
How can I make the following MWE work and what's the underlying issue?
\documentclass{beamer}
\newcommand{\lvlang}{DE}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{comment}
\usepackage{ifthen}
\newcommand{\iflvlangde}[2]{%
\ifthenelse{\equal{\lvlang}{DE}}{#1}{#2}%
}
\makeatletter
\iflvlangde{
\usepackage[main=ngerman]{babel}
\includecomment{DE}
\excludecomment{EN}
}{
\usepackage[main=english]{babel}
\includecomment{EN}
\excludecomment{DE}
}
\makeatother
\begin{document}
\begin{DE}
\begin{frame}[fragile]{mäh}
föö
\end{frame}
\end{DE}
\end{document}
\if \else \fi
? This is how I handle bilingual cases where some instances should use one language and some another. (I haven't tried with Beamer, though.) You shouldn't needfragile
for the frame you show and, if that's forced by this approach, you really don't want to use it. At least, I wouldn't.