3

I'm using LuaLaTeX and wonder why I cannot label theorems with words containing umlauts. For example:

\documentclass[a4paper,12pt]{article}
\usepackage{luatextra}
\usepackage[utf8]{luainputenc}
\usepackage{amsthm}
\newtheorem{thm}{Theorem}
\begin{document}
    \begin{thm} {\bf Exämple's_theorem}
             %\label{Exämple's theorem} % does not work
              \label{Exaemple's_theorem} % does work

        Lorem ipsum etc.
    \end{thm}
\end{document}

Has anyone a clue why this is and - maybe how to resolve this ? I'm just curious for the underlying reason. Writing 'ae' instead of 'ä' is not a hard thing to do, so no solution is no problem.

Additionally lacheck says you shouldn't use spaces in labels, but there occurred no errors during compilation - another white spot in my knowing latex/luatex map.

lockstep
  • 250,273
epsilonhalbe
  • 1,020
  • With "normal" LaTeX umlauts are usually active characters, i.e. macros, which are fragile and can't be written without issues into auxiliary files. No idea, if LuaLaTeX is any better here. – Martin Scharrer Oct 12 '11 at 11:30

2 Answers2

4

The package luainputenc can be useful to convert legacy documents to LuaLaTeX use and should not be used in new documents.

The following document works:

\documentclass[a4paper,12pt]{article}
\usepackage{amsthm}
\usepackage{fontspec} % don't forget it with lualatex
\newtheorem{thm}{Theorem}

\begin{document}
\begin{thm}[Exämple's theorem]\label{Exämple's theorem}
Lorem ipsum etc.
\end{thm}
\end{document}

Note that amsthm should be loaded before fontspec and _ can't be used in normal text without protection. Also, theorem names or attributions should be given as optional argument to the environment.

egreg
  • 1,121,712
  • thanks for your answer, but when i call lualatex test.tex - the compiler asks for XeTeX.

    additionally thanks for noting the luainputenc - is not necessary

    – epsilonhalbe Oct 12 '11 at 17:56
  • could it be an error due to the fact that i use texlive-2009 (I'm on a debian machine) – epsilonhalbe Oct 12 '11 at 18:56
  • i had a not so brief look on the fontspec documentation and found "fontspec needs an up to date texlive 2011 installation" so no fontspecfun for me (for now) – epsilonhalbe Oct 12 '11 at 21:03
  • @epsilonhalbe There's fontspec also in TeX Live 2009, but I believe it doesn't work with LuaLaTeX. Actually it's not necessary; but the best is to upgrade to TeX Live 2011. – egreg Oct 12 '11 at 21:11
  • i tried to upgrade a few packages - but nothing is working the way i want - i'll upgrade as soon as i can afford some time for it. thanks anyway and good night ;-) – epsilonhalbe Oct 12 '11 at 22:57
2

You have some misstakes in your code:

  • the command \bf is obsolete. For more details see l2tabu
  • every theorem-environment has an optional argument with the title of the theorem
  • the underscore needs special handling.
  • don't use special characters like German umlaut in labels.

Some information are provided in my earlier answer: Despite using backslash dollar sign, error persists

Marco Daniel
  • 95,681