Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to enter Umlauts directly in math? I would like to do something like the following (using XeLaTex):

\documentclass{article}
\usepackage{amsmath}
\usepackage[silent,no-math]{fontspec}

\usepackage{unicode-math}
\setmathfont[math-style=TeX]{XITS Math}


\begin{document}

\begin{align*}
äöüÄÜÖ
\end{align*}

\end{document}

I know that I can also use \ddot{a}, but I would like my source file to be easily readable; and besides, things like \ddot{a}_j^i give bad positioning of the dots.

Any help would be appreciated.

Clarification: In my case, e.g. ü is not the second derivative of u, but rather it is a symbol representing Überschüsse (german for: surplus / excess). In the context of the document, confusion with the second derivative is unlikely.

share|improve this question
9  
I'm not sure it's a good idea: ä and \ddot{a} are semantically different. –  egreg Jun 21 '12 at 13:50
4  
Also, the bad positioning of the dots is a bug that is fixed in TeX Live 2012. –  Khaled Hosny Jun 21 '12 at 13:53
    
Welcome to TeX.SX! I forgot to say it before, sorry! :) –  egreg Jun 21 '12 at 13:57
2  
See also tex.stackexchange.com/q/59847/5001. To reinforce @egreg's view, it may actually be a bad idea to use vowels with diereses (Umlaute) in math mode in technical documents: Depending on the context (e.g., physics/mechanics), the "double dots" may lead your readers to start thinking that you're dealing with the second derivative (of the symbol in question) with respect to time. –  Mico Jun 21 '12 at 14:05
1  
Indeed, ü is semantically correct in my case since I am not referring to the second derivative (I edited the original problem to make this clear). \textit{ü} works, but I had hoped that using umlauts in maths might work more natively. Besides, exponents and indices in combination with \textit{ü} seem to have bad positioning as well. –  Stefan Jun 22 '12 at 5:54
show 5 more comments

3 Answers

If I understand the intent of your comments correctly, you think that your input file could be marginally easier to read if you wrote, while in math mode, ä and ö for the second derivative of the variables a and o with respect to time. My advice, in brief: Don't do it! Instead, use \ddot{a}, \ddot{o}, etc.

Why? There are at least two reasons for giving this recommendation:

  • First, the positioning of the double-dots (dieresis, Umlaut) is not the same for text-mode and math-mode patterns. Should some formula feature both ö and \ddot{m}, say, in close proximity, you and the readers of your paper(s) wwould notice quickly that the positioning of the double-dots above the o and m characters is quite different; as a result, the formula as a whole wouldn't look quite right.

  • Second (at least when working with a well-designed math font family, such as XITS Math), the shape of the underlying vowel also differs between math mode and (italics) text mode. Thus, if you used both o and ö in the same formula, one would again notice quickly that the two "o" shapes are not the same; once again, the formula as a whole wouldn't look right.

In the MWE below, I've tried to illustrate these two types of differences by superimposing the text-italics ä, ö, and ü characters with their math-mode siblings $\ddot{a}$, $\ddot{o}$, and $\ddot{u}$; the math-mode glyphs are in red. Notice the differences in (i) the positioning of the diereses and (ii) the characters' basic shapes. For all three vowels (for the case of XITS and XITS Math fonts), the math-mode versions are narrower than the text-italics version. The differences aren't huge, for sure, but they're likely to be sufficiently pronounced to cause some readers to become distracted and/or confused.

enter image description here

\documentclass{article}
\usepackage{fontspec,amsmath,xcolor,unicode-math}
\setmainfont{XITS}
\setmathfont[math-style=TeX]{XITS Math}
\begin{document}
\Huge
% determine widths of the letters ä, ö, and ü
\newlength\alength
\settowidth{\alength}{\emph{ä}} 
\newlength\olength
\settowidth{\olength}{\emph{ö}} 
\newlength\ulength
\settowidth{\ulength}{\emph{ü}}

\emph{ä}\kern-\alength\textcolor{red}{$\ddot{a}$}

\emph{ö}\kern-\olength\textcolor{red}{$\ddot{o}$}

\emph{ü}\kern-\ulength\textcolor{red}{$\ddot{u}$}
\end{document}
share|improve this answer
add comment

There is no accented character in the "math" part of Unicode, because diacritics can be confused with math specific ornaments, such as the dot/dots for denoting derivatives.

According to a well established tradition, an ê in a formula is read as e hat even if the document is in Portuguese and usually it is interpreted as "some functional transformation on the variable e" (such a functional transformation would have previously been defined).

Therefore I don't find it a good idea to use ü for denoting a variable by itself. I'd use u and, if u is already used with another meaning, I would not adopt ü for the other one, in order to avoid any ambiguity.

This said, if you really want to use ü as a variable, you can try

\usepackage{newunicodechar}
\newunicodechar{ü}{\ifmmode\textit{ü}\else ü\fi} % version with \textit
%\newunicodechar{ü}{\ifmmode\ddot{u}\else ü\fi} % version with \ddot

and $ü=12$ will result in an italic "ü" and "Flügel" in text would print correctly as well.

Choose between the two versions according to which one renders better. But you've been warned. :)

share|improve this answer
    
Unfortunately, this does not work for me. \documentclass{article} \usepackage{amsmath} \usepackage[silent,no-math]{fontspec} \usepackage{newunicodechar} \newunicodechar{ü}{\ifmmode\mathit{ü}\else ü\fi} \usepackage{unicode-math} \setmathfont[math-style=TeX]{XITS Math} \begin{document} ü % renders correctly \begin{align*} ü % does not render \end{align*} \end{document} –  Stefan Jun 25 '12 at 6:24
    
@Stefan Sorry, it was \textit and not \mathit. –  egreg Jun 25 '12 at 6:56
add comment

There is no really good solution to your problem -- at least if you want to use unicode-math. The problem lies not in XeTeX or the package but in unicode itself:

The italic variables are not generated by switching to a different shape of your math font (there is no "italic xits math") but by using special chars in the "Mathematical Alphanumeric Symbols" unicode block (http://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols). And if you look at the table you will see that this block doesn't have umlauts. With unicode-math you can access this symbols with \mita \mitb etc.

If you try to add the missing "variables" with \textit you will use the text font of your document and depending on the font the result can look quite odd:

\documentclass{article}
\usepackage{amsmath}
\usepackage[silent,no-math]{fontspec}
\usepackage{unicode-math}
\setmathfont[math-style=TeX]{XITS Math}
\setmainfont{Arial}
\begin{document}
$\textit{äa}abc\mita\mitb\mitc$
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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