# Flexible definition of Theorem/Satz and its reference not working correctly

I am trying to combine ntheorem, translations and cleveref to define a multilingual theorem environment that is called “Theorem” or “Satz” depending on the language but I am stuck with the following problem:

\documentclass[ngerman]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ntheorem,translations}
\usepackage[capitalise]{cleveref}

\begin{filecontents}{tr-german.trsl}
\ProvideDictionaryFor{German}{tr}
\ProvideDictTranslation{Theorem}{Satz}
\ProvideDictTranslation{Theorems}{Sätze}
\end{filecontents}
\LoadDictionaryFor{German}{tr}

% \newtheorem{theorem}{\GetTranslation{Theorem}}[chapter]
\Crefname{theorem}{\GetTranslation{Theorem}}{\GetTranslation{Theorems}}

\AtBeginDocument{%
\newtheorem{theorem}{\GetTranslation{Theorem}}[chapter]
}
\begin{document}
\begin{theorem}[A]
\label{thm:A}
B
\end{theorem}
See \cref{thm:A}
\end{document}


With the commented out line of a new theorem I get 4 undefined control sequences like

Undefined control sequence.
<argument> ...@language@\@trnslt@current@language


so it seems that something is not yet ready with the languages yet? I can do it at begin of document, but then neither the definition of the theorem name nor the cleverer seem to pick up the language. They stay with Theorem what ever I do.

Sometimes (and I can not recreate that in an MWE) at least the \newtheorem seems to pick up the language, but the cleverer reference name always stays at Theorem independent of then where and how I try to redefine it.

Any idea how to convince both to print Satz instead of Theorem loaded from the translations list?

## 1 Answer

There are two issues with your MWE. First is that you didn't load babel, and so the current language is never changed to ngerman. The second is that \newtheorem (at least the ntheorem version) tries to expand the argument at time of definition, which you don't want (and is contrary to the intent of the translations package).

A work around: protect your definition of your theorem (and of course load babel)

\documentclass[ngerman]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{ntheorem,translations}
\usepackage[capitalise]{cleveref}

\begin{filecontents}{tr-german.trsl}
\ProvideDictionaryFor{German}{tr}
\ProvideDictTranslation{Theorem}{Satz}
\ProvideDictTranslation{Theorems}{Sätze}
\end{filecontents}
\LoadDictionaryFor{German}{tr}

\newtheorem{theorem}{\protect\GetTranslation{Theorem}}[chapter]
\Crefname{theorem}{\GetTranslation{Theorem}}{\GetTranslation{Theorems}}

\begin{document}
\begin{theorem}[A]
\label{thm:A}
B
\end{theorem}
See \cref{thm:A}

\GetTranslation{Theorems}
\end{document}


• Thanks babel might be my confusion why my project behaved different from my MWE :) I will check your solution soon! Aug 13 '21 at 20:29
• So in my large project (that I tried to minimise here, I still get See Theorem 0.1 instead of Satzm so I reduced my example wrongly to this MWE – I will update as soon as I see a difference. Aug 13 '21 at 20:38
• We figured out our problem was, that the above definition was reset at begin document for some cases (by other packages triggering a language switch in cleveref. But for the problem stated here, your answer is the solution. Aug 19 '21 at 9:33