2

I read chapter 10 of the cleveref-manual and thought, that my following code would work, but it crashes. The special character can't be handled by cleveref.

Did I made a mistake? Or is there a solution?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage[ngerman]{cleveref}

\newtheorem{thm}{ü}

\begin{document}

\begin{thm} \label{dummy}
test
\end{thm}

See \Cref{dummy}.

\end{document}
  • Eh... you're changing the question! Of course beforeüafter won't work as the environment name (at least not in this way!) – user31729 Sep 6 '16 at 15:46
  • Ben: Yes, of course, but I could guess you would not get much encouragement for this. I am a German native speaker and have no worries using English command names, as long as the typesetting output is using German names. – user31729 Sep 6 '16 at 15:53
  • Environments' names should only consist of letters (and possibly of standard printable ASCII characters such as *). Avoid accented letters that also make typing awkward, for the simple reason they don't work. – egreg Sep 6 '16 at 15:55
  • @Ben: Really? It should fail to compile, in my opinion, even without \Cref etc. – user31729 Sep 6 '16 at 16:00
  • @Ben No, it doesn't work as soon as you load inputenc. – egreg Sep 6 '16 at 16:39
4

ü is no single character and is a fragile command actually, but using \newtheorem{thm}{{ü}} will work, i.e. grouping the command.

From the screenshot you will see that cleveref is really clever: It uses the correct uppercase character Ü if \Cref is applied, although it specified directly!

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{amsthm}
\usepackage[ngerman]{cleveref}

\newtheorem{thm}{{ü}}

\begin{document}

\begin{thm} \label{dummy}
test
\end{thm}

See \Cref{dummy} or \cref{dummy}.

\end{document}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.