2

in my minimum example

\documentclass[12pt]{article}
\usepackage[sfdefault]{FiraSans}    
\usepackage{newtxsf}
\begin{document}
This is a test: $5$ = 5
\end{document}

compiled with lualatex -shell-escape doc.tex I get a wrong font for math-digits: wrong-font-math-digits

What can I do to get the same digits as in non-math-mode?

  • 6
    Why you say wrong? It is math font, not equal to text font. This is acceptable. Of course, depending which text font you use, it could be ugly, but not wrong. – Sigur Dec 28 '17 at 15:08
  • I'd like the math-font to be equal or at least similar to the text-font. Digits should look the same. – user2033412 Dec 28 '17 at 15:10
  • @Sigur With newtxsf the math should be sans serif. – user36296 Dec 28 '17 at 15:12
  • @user2033412 Would compiling with pdflatex be a workaround? – user36296 Dec 28 '17 at 15:13
  • @samcarter: nope -- The build-server uses lualatex. – user2033412 Dec 28 '17 at 15:18
3

With lining numbers it's not so difficult.

\documentclass[12pt]{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage[sfdefault,lining,scaled=0.9]{FiraSans}
\usepackage{newtxsf}

\DeclareSymbolFont{digits}{TU}{\sfdefault}{m}{n}
\DeclareMathSymbol{0}{\mathalpha}{digits}{`0}
\DeclareMathSymbol{1}{\mathalpha}{digits}{`1}
\DeclareMathSymbol{2}{\mathalpha}{digits}{`2}
\DeclareMathSymbol{3}{\mathalpha}{digits}{`3}
\DeclareMathSymbol{4}{\mathalpha}{digits}{`4}
\DeclareMathSymbol{5}{\mathalpha}{digits}{`5}
\DeclareMathSymbol{6}{\mathalpha}{digits}{`6}
\DeclareMathSymbol{7}{\mathalpha}{digits}{`7}
\DeclareMathSymbol{8}{\mathalpha}{digits}{`8}
\DeclareMathSymbol{9}{\mathalpha}{digits}{`9}

\begin{document}
This is a test: $0123456789$ = 0123456789

$a-b=c$ abc

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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