8

I want to use the font Fira Sans for my document, but this font has only "old-style" numbers. I was wondering if it was possible to change only the numbers' font so it would be different from the alphabetical characters.

I searched a lot but all answers I could find would only change the font in math mode using \DeclareMathSymbol, I want this modification to affect all the document.

Thank you.

PS: I realize I could just use another font which has regular numbers, but I want to know (no matter the extra work) if its feasible.

4
  • 10
    Welcome to TeX.SX! If I call \usepackage[sfdefault,lining]{FiraSans}, the numbers are lining.
    – egreg
    Sep 6, 2015 at 22:28
  • And the opentype font supports at least 4 different styles of figures: oldstyle, lining, proportional and tabular (2x2). The FiraSans package also supports the 2x2 set of possibilities.
    – cfr
    Sep 7, 2015 at 1:17
  • The solutions by @egreg sets the lining (proportional, ...) style of figures for the whole document. Is there an easy way to change the lining of the math mode only - to retain readability throughout the text, but align numbers within specific equations?
    – tipavi
    Jan 16, 2018 at 13:14
  • @tipavi In unicode-math, you can \setmathfont[range=up/Digits, Numbers={Lining, Proportional}, Scale=MatchUppercase]{Fira Sans}. You could also try the experimental Fira Math font.
    – Davislor
    May 16, 2019 at 18:43

2 Answers 2

1

You seem to have an XY problem. In LuaTeX or XeTeX, you can turn off old-style numbers with

\usepackage{unicode-math}
\defaultfontfeatures{Numbers=Lining}

\setmainfont{Fira Sans}
\setsansfont{Fira Sans}
\setmonofont{Fira Mono}
\setmathfont{Fira Math}

Or \usepackage[fira]{fontsetup} might work.

In PDFTeX, load

\usepackage[lining, sfdefault]{FiraSans}
\usepackage{FiraMono}

to load Fira Sans with lining numbers as the default font, and Fira Mono as the matching monospace font. You would also need to load a sans-serif math package, and set its letters and numerals to use the main text font with \usepackage[italic]{mathastext}.

0

With XeLaTeX and fontspec it's fairly easy :

\usepackage{fontspec}
\setmainfont[]{Fira Sans}
\setmathrm[]{Anotherfont}

Or you could check your font and the doc of Fontspec to edit \setmathrm[]{Fira Sans} with the adequate options if it's available.

You must log in to answer this question.

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