2

I have tried to change the vertical space in fractions using LuaLaTeX and STIX fonts.

I have used the following commands

\Umathfractionnumup\textstyle
\Umathfractiondenomdown\textstyle
\Umathfractionnumvgap\textstyle
\Umathfractiondenomvgap\textstyle

But nothing happens. I have also tried incrementing space and decrementing the spaces

\Umathfractionnumup\textstyle = 2 ex
\Umathfractiondenomdown\textstyle = 2 ex
\Umathfractionnumvgap\textstyle = 6 pt
\Umathfractiondenomvgap\textstyle = 6 pt

and

\Umathfractionnumup\textstyle = 0.5 ex
\Umathfractiondenomdown\textstyle = 0.5 ex
\Umathfractionnumvgap\textstyle = 0 pt
\Umathfractiondenomvgap\textstyle = 0 pt

and nothing happens. Numerator and denominator stay always fixed.

Thus I have tried with latinmodern-math font and another strnge thing happens.

Using \setmathfont{latinmodern-math} the situation is the same as with STIX font. Nothing happens by changing \Umath commands.

\documentclass{article}
%\usepackage{fontspec}
\usepackage{unicode-math}
%\setmathfont{texgyrepagella-math}
%\setmathfont{STIXTwoMath-Regular.otf}
%\setmathfont{STIX2Math}
\setmathfont{latinmodern-math}
\begin{document}
\Umathfractionnumup\textstyle=10pt
\Umathfractiondenomdown\textstyle=10pt
\Umathfractionnumvgap\textstyle=10pt
\Umathfractiondenomvgap\textstyle=10pt
\Umathfractionnumup\displaystyle=10pt
\Umathfractiondenomdown\displaystyle=10pt
\Umathfractionnumvgap\displaystyle=10pt
\Umathfractiondenomvgap\displaystyle=10pt

Texstyle $\frac12$

displaystyle
$$\frac12$$

\end{document}

using \setmathfont

but if I don't use the \setmathfont{latinmodern-math} command the \Umath commands have effect. The strange is the the font used remain latinmodern-math.

\documentclass{article}
%\usepackage{fontspec}
\usepackage{unicode-math}
%\setmathfont{texgyrepagella-math}
%\setmathfont{STIXTwoMath-Regular.otf}
%\setmathfont{STIX2Math}
%\setmathfont{latinmodern-math}
\begin{document}
\Umathfractionnumup\textstyle=10pt
\Umathfractiondenomdown\textstyle=10pt
\Umathfractionnumvgap\textstyle=10pt
\Umathfractiondenomvgap\textstyle=10pt
\Umathfractionnumup\displaystyle=10pt
\Umathfractiondenomdown\displaystyle=10pt
\Umathfractionnumvgap\displaystyle=10pt
\Umathfractiondenomvgap\displaystyle=10pt

Texstyle $\frac12$

displaystyle
$$\frac12$$

\end{document}

without \setmathfont

In the log file the used font is latinmodern-math. Also opening PDF file the font is always the same.

1
  • When I tried \loadmath{[STIXTwoMath-Regular]} followed by your set of \Umath... commands followed by your $1\over2$ test followed by \bye in OpTeX then all works. I.e. the vertical spaces are in the fractions. It means that the problem is not in the font, not in the LuaTeX, but only in the used macro.
    – wipet
    Commented Jan 25, 2021 at 17:44

1 Answer 1

3

Some things are not fully set up until the first use of math so your settings get undone on this first use initialisation.

You can typeset a math list into a box and discard it to get things started:

\documentclass{article}
%\usepackage{fontspec}
\usepackage{unicode-math}
%\setmathfont{texgyrepagella-math}
%\setmathfont{STIXTwoMath-Regular.otf}
%\setmathfont{STIX2Math}
\setmathfont{latinmodern-math}
\begin{document}

\sbox0{$$}

\Umathfractionnumup\textstyle=10pt
\Umathfractiondenomdown\textstyle=10pt
\Umathfractionnumvgap\textstyle=10pt
\Umathfractiondenomvgap\textstyle=10pt
\Umathfractionnumup\displaystyle=10pt
\Umathfractiondenomdown\displaystyle=10pt
\Umathfractionnumvgap\displaystyle=10pt
\Umathfractiondenomvgap\displaystyle=10pt


Texstyle $\frac12$

displaystyle
$$\frac12$$

\end{document}

enter image description here

3
  • Many thanks, you are right. Now it is good. But this mean that it is not possible to insert in the preamble as default setting? Commented Jan 26, 2021 at 14:52
  • @BrunoGuizzon currently (there are some issues complaining about it:-) unicode-math does almost all its setup \AtBeginDocument so if you want to over-ride it in the preamble you almost always need to \AtBeginDocument{...} around the code so that it comes later, but that is usually enough. Commented Jan 26, 2021 at 15:02
  • Yes. It's OK. Many thanks again. Commented Jan 26, 2021 at 18:23

You must log in to answer this question.

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