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.

1
  • 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. Commented Aug 10, 2016 at 17:03

2 Answers 2

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

3
  • Is surrounding \textit with \textnormal necessary? \textit by itself would appear to suffice.
    – Mico
    Commented Aug 10, 2016 at 18:50
  • @Mico add \bfseries to see the difference. Commented Aug 10, 2016 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
    Commented Aug 11, 2016 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.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .