# Oldstylefigure issue with lualatex and mathastext

I'm trying to figure out what causes OSF to be selected in mathematics. Following is the MWE.

% arara: lualatex
\documentclass[9pt,fleqn]{extarticle}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[no-math]{fontspec}
\setmainfont[BoldFont=Vollkorn Medium, BoldItalicFont=Vollkorn Medium Italic, Numbers={Proportional,Uppercase}]{Vollkorn}
\usepackage[italic,defaultmathsizes]{mathastext}
\begin{document}
123 \emph{123} % no problems here

$\int_1^3 f(x)$ % problem here
\end{document}

• If you are using xetex or luatex (as you must be with fontspec you should never load inputenc (if you are using the 2014 version it warns and does nothing, older versions will break the document completely) – David Carlisle Oct 23 '14 at 19:48
• OK for the hint. But this is not the solution for the problem. – s__C Oct 23 '14 at 19:49
• yes but I haven't the fonts so can't comment on your main problem:-) – David Carlisle Oct 23 '14 at 19:51
• I wasn't complaining about that. By the way vollkorn is free. – s__C Oct 23 '14 at 19:54
• It works with XeLaTeX but not with LuaLaTeX. – cfr Oct 23 '14 at 19:55

Update version 1.3n of mathastext dated 2016/05/03 will have a patch for this LaTeX+LuaTeX+luaotfload issue. Ultimately, perhaps LaTeX will be updated to modify \DeclareSymbolFont to take into account the kind of modification implemented by mathastext, and then the mathastext patch will prove unneeded. I will also provide a patch to url.sty in an answer I will post to Can't get oldstyle figures in url with lualatex

This appears not to be an issue with mathastext but rather one of lualatex in math mode. Here is some code to exhibit the font used for digits by mathastext in math mode. The output looks correct for both xelatex and lualatex but for the latter the figures are oldstyle despite what I understand of the font descriptor.

\documentclass[9pt,fleqn]{extarticle}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{fourier}
\usepackage[no-math]{fontspec}
\usepackage{iftex}

\setmainfont[BoldFont=Vollkorn-Medium.ttf,
ItalicFont=Vollkorn-Italic.ttf,
BoldItalicFont=Vollkorn-BoldItalic.ttf,
Numbers=Lining]{Vollkorn-Regular.ttf}%
\usepackage[italic,defaultmathsizes]{mathastext}

%\MTseries{bx}\Mathastext

\begin{document}\thispagestyle{empty}
\fontname\font\newline
1234567890

\emph{\fontname\font\newline 1234567890}

% check the font used by mathastext

Here is the name of the font used for digits in math mode:

$\hbox{\fontname\textfont\symmtoperatorfont}$

This is the very same font as the one used for this text and digits 01234567890
but nevertheless we see old style figures in math mode:
$1234567890$
\end{document}


output for xelatex: (with the end of last sentence removed)

output for lualatex: