I built a custom language-switch macro for my document. It seems to be working fine in some cases, but not in others. How to make this work in any case, e.g. just output the content of the first or second bracket depending on my LANGUAGE flag?
Here is the minimal working example:
\documentclass[11pt,a4paper]{article}
\usepackage{xifthen}
\newcommand{\LANGUAGE}{DE} % or EN
% language selector, the command \LANGUAGE needs to be set before
\newcommand{\deen}[2]{\ifthenelse{\equal{\LANGUAGE}{DE}}{#1}{\ifthenelse{\equal{\LANGUAGE}{EN}}{#2}{NO LANGUAGE}}}
% content
\begin{document}
\section{Some title}
\deen{first entry}{second entry} % this one works
\section{Another title}
%\subsection{\deen{First language}{Second language}} % this one fails
\end{document}
With the current setting (LANGUAGE=DE), the document looks like this:
1 Some title first entry 2 Another title
Changing the flag to LANGUAGE=EN does the trick in the first case (the line "first entry" will be changed to "second entry"), but when including it in e.g. \subsection{} it fails with the following error:
! Undefined control sequence.
<argument> \equal
{\LANGUAGE }{DE}
l.14 ...on{\deen{First language}{Second language}}
Any help is appreciated!


\documentclassup to\end{document}? – egreg Dec 10 '17 at 22:59\chapter{\deen{Kapitel}{Chapter}}{}What kind of document class are you using or what is the{}supposed to do? – Dec 10 '17 at 23:27