# Unicode-math and fractions

I try to use unicode-math with Linux Libertine, and the result is in general working fine. In my opnion, the main problem is fractions. Consider the below example where there is far too much space above the horizontal line. Is there a way to fix this?

I know that Linux Libertine is not intended for use with math, but it might be that this particular issue could be solved.

(BTW, I compiled my document using LuaLaTeX.)

\documentclass{article}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmathfont[Scale=MatchLowercase]{Latin Modern Math}
\setmathfont[range=\mathup]{Linux Libertine O}
\setmathfont[range=\mathit/{latin,Latin,num}]{Linux Libertine O Italic}
\setmathfont[range=\mathbfup]{Linux Libertine O Bold}
\setmathfont[range=\mathbfit]{Linux Libertine O Bold Italic}

\begin{document}
$\frac{27}{81},\qquad \frac{\pi^2}{6}$
\end{document}


You can change the value like this (see also Overline thickness and the documentation of luatex for more commands):

\documentclass{article}
\usepackage{unicode-math}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setmathfont{Latin Modern Math}
\setmathfont[range=\mathup]{Linux Libertine O}
\setmathfont[range=\mathit/{latin,Latin,num}]{Linux Libertine O Italic}
\setmathfont[range=\mathbfup]{Linux Libertine O Bold}
\setmathfont[range=\mathbfit]{Linux Libertine O Bold Italic}
\setmathfont[range=\int]{Latin Modern Math} %last font should be a math font

\begin{document}
\makeatletter\check@mathfonts\makeatother %to force mathsetup
\luatexUmathfractionnumup\displaystyle=2pt

$\frac{27}{81},\qquad \frac{\pi^2}{6}$
\end{document}


• Very nice solution, thought it would be best to adjust \luatexUmathfractiondenomdown similarly. May 19 '15 at 12:27
• @Gaussler: You asked about the space above the line ... I leave the rest of the finetuning (including which values please you best) to you, May 19 '15 at 12:37
• Indeed, you did exactly what I asked. I wrote the comment to make future readers aware of the existence of the denominator counterpart. May 19 '15 at 12:38
• Also, I was not aware that LuaTeX provided such advanced control for math layout directly through primitives. So in principle, if I go through all of them and adjust them one by one, I get the equivalent of a Microsoft Math Table for any font I want? May 19 '15 at 12:43