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.

After fiddling around with egreg's answer to my previous question, I finally discovered that lualatex is not selecting the tnum OpenType features, that is it uses the default numerals instead of the monospaced lining, whereas xelatex does select the correct numerals.

The Goal

To use the Calluna font, with OldStyle figures in the main text, and Lining figures in mathmode, using code that's preferably compilable using lualatex.

The Problem

Calluna has OldStyle figures by default, so the named character one returns a LowerCase 1. The code supplied by egreg is supposed to select the character one.tnum in math mode (or pnum as it stands in his original answer, but that only influences horizontal spacing). His code works fine using xelatex, but lualatex produces the character one instead, which for most fonts is actually a lining, proportional, figure, so exactly what egreg expected, but for Calluna this is an oldstyle, proportional numeral. Since Calluna is not freely available I changed the code to use EB Garamond which produces the same result.


The problem really is in the combination of lualatex and egreg's code, since the normal \setmainfont options are respected perfectly fine by lualatex, if I set these to Lining I get Lining figures in the main text, but still not in the math text. See my original question as well for the reasons to use this code instead of mathspec for example.

After filing an issue at the luaotfload GitHub, it appears the problem was that fontspec uses the Renderer=Full/mode=node option by default, while in math mode mode=base/Renderer=Basic should be used. However, now the font features are applied inconsistently, randomly changing between compilations.

The Question

How can I change the code, such that lualatex consistently uses the Lining, Monospaced numerals (OpenType feature tnum) in math mode, while using eulervm for all other characters in mathmode?

The Code



%  ]{Calluna}
    ]{TeX Gyre Heros}
    ]{TeX Gyre Cursor}

% LuaTeX uses the full renderer by default, this does not work in math mode, so negate manually
%        ]{Calluna}
%        ]{Calluna}

% A trick for extracting the family information
% which works independently of the chosen font
    \getfamily\csname liningmain \endcsname}}\x

\Umathcode`0="7 \symliningmath `0
\Umathcode`1="7 \symliningmath `1
\Umathcode`2="7 \symliningmath `2
\Umathcode`3="7 \symliningmath `3
\Umathcode`4="7 \symliningmath `4
\Umathcode`5="7 \symliningmath `5
\Umathcode`6="7 \symliningmath `6
\Umathcode`7="7 \symliningmath `7
\Umathcode`8="7 \symliningmath `8
\Umathcode`9="7 \symliningmath `9

        math-rm = \mathlining,



Mode & Result\\
Normal font & \fontname\font\\
Lining font & {\liningmain\fontname\font}\\
Text mode & 1234567890\\
Math mode & \(1234567890\)\\
\verb|\SI| text mode & \SI{1042358769}{\metre}\\
\verb|\SI| math mode & \(\SI{1234567890}{\metre}\)\\
\verb|\num| text mode & \num{1234567890}\\
\verb|\num| math mode & \(\num{1234567890}\)\\
verbatim & \verb|1234567890|\\

share|improve this question

1 Answer 1

up vote 6 down vote accepted

The problem is in luatex (possibly in luaotfload); if I ask the font corresponding to \liningmain from your code, I get


with XeLaTeX and


with LuaLaTeX. So I prepared the following file

\input ifxetex.sty

  \input luaotfload.sty





Since digits in math mode use \textfont0 by their default definition, I should get two sets of lining figure. This is what I get with xetex

XeTeX result

and the result with luatex follows

enter image description here

So it appears that attributes are ignored by LuaTeX when the font is used in math mode. Where the bug resides I don't know.

For getting the font name, just add at the end of your example


and compile with XeLaTeX and LuaLaTeX. I removed the option RawFeature=+tnum that just adds +tnum once more and makes no difference.

share|improve this answer
I should then just file an issue on the github of luaotfload? And how did you get the font specification? I'm a little curious if there is any difference between the specification of liningmain and \setmainfont that might cause lualatex to ignore the attributes. –  hugovdberg Mar 13 at 10:10
Issue filed at github.com/lualatex/luaotfload/issues/204 –  hugovdberg Mar 13 at 21:59

Your Answer


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.