I want to set the title of a section with a command which includes an \ifthenelse condition:
\documentclass{article}
\usepackage{ifthen}
\newcommand{\region}{Germany}
\newcommand{\getValue}{
\ifthenelse{\equal{\region}{Germany}}{
Kapitel 1
}{
Chapter 1
}
}
\begin{document}
\section{\getValue}
\end{document}
This however doesn't work and I would like to know why it doesn't work and how to get it working. I receive a lot of errors when I compile the minimal working example which I don't know how to fix. I could very easily solve the problem in the example by the following:
\begin{document}
\ifthenelse{\equal{\region}{Germany}}{
\section{Kapitel 1}
}{
\section{Chapter 1}
}
\end{document}
However this workaround is not an option for me in production as I want to use the getValue command in this case more frequently. I had a look at this question however apart from the title the question doesn't have much in common with this question.
\getValuecommand without\ifthenelsee.g.\newcommand{\getValue}{Kapitel 1}. Why is it working in this case but not with\ifthenelse? – Jonathan Jul 21 '20 at 11:53