1

I would like to use the math mode without writing special orders for using umlauts. I'm using LuaLatex and babel.

What would be needed for a nice umlaut support? I do know how to work without out it.

\documentclass{article}
\usepackage[utf8]{luainputenc}
\usepackage[ngerman]{babel} 
\usepackage{fontspec}

\begin{document}
It would be nice to write just:
$Höhe > 1$

instead of: 
$H\ddot{o}he > 1$

textnormal and texit are getting the best output
$\textnormal{\textit{Höhe}} > 1$

\end{document}

enter image description here

For People searching how to have umlauts displayed - here is a better Question.

TimK
  • 703
  • i'm not a lualatex user, but whatever the tex engine, this looks like a word, and should thus be treated as one, not as a string of separate letters representing variables -- the spacing is not appropriate for a word. – barbara beeton Aug 10 '16 at 17:03

2 Answers2

3

The input Höhe is wrong: in math letters are single entities, they don't build words and so Höhe is the same as H ö h e, a product of 4 variables.

Using \mathit or \textnormal\textit as you did in your example is a good solution. If you have lot of such words I would suggest to define a semantic command:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{fontspec}
\newcommand\mathword[1]{\textnormal{\textit{#1}}}
\begin{document}

$\mathit{Höhe} > 1$

$\textnormal{\textit{Höhe}} > 1$

$\mathword{Höhe} > 1$
\end{document}

When using unicode-math you will have to remap \mathit as the default definition don't support umlauts:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmathfontface\mathit{lmroman10italic}

\newcommand\mathword[1]{\textnormal{\textit{#1}}}
\begin{document}

$\mathit{Höhe} > 1$

$\textnormal{\textit{Höhe}} > 1$

$\mathword{Höhe} > 1$
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • Is surrounding \textit with \textnormal necessary? \textit by itself would appear to suffice. – Mico Aug 10 '16 at 18:50
  • @Mico add \bfseries to see the difference. – Ulrike Fischer Aug 10 '16 at 18:55
  • The input Höhe is wrong: in math letters are single entities, they don't build words and so Höhe is the same as H ö h e, a product of 4 variables.

    Thank you very much! That makes everything crystal clear. My fault, I haven't thought about it!

    – TimK Aug 11 '16 at 13:16
1
\documentclass{article}
\usepackage{amsmath}
\usepackage[ngerman]{babel} 
\usepackage{fontspec}
\newcommand\textIT[1]{\text{\itshape#1}}    
\begin{document}
    It would be nice to write just:
    $\textIT{Höhe}^\textIT{Höhe} > 1$

\end{document}

enter image description here

By the way: Why do you use luainputenc? UTF8 is the default input encoding.

  • You're totally right about not having to use luainputenc. I do not know why I used it, normally I'm not using it.

    I think I will use mathit, because it is also suggested in Section 9.1 http://ftp.fau.de/ctan/macros/latex/required/amslatex/math/amsldoc.pdf

    – TimK Aug 11 '16 at 13:29