is it possible to get old-style numerals as sans serif? \oldstylenums is with serifs only as far as I see. Or do I need an additional font? (if yes, which one would be suggested?)
Cheers and thanks, Thomas
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityis it possible to get old-style numerals as sans serif? \oldstylenums is with serifs only as far as I see. Or do I need an additional font? (if yes, which one would be suggested?)
Cheers and thanks, Thomas
If you want to stick with the default TeX font, then you could use cfr-lm
. This font isn't exactly Computer Modern, but Latin Modern, a modern clone of CM. The package allows to customize the font loading.
\documentclass{article}
\usepackage[sf=oldstyle]{cfr-lm}
\begin{document}
\textsf{1234567890}
\end{document}
or you could switch to old style numerals on demand
\documentclass{article}
\usepackage{cfr-lm}
\begin{document}
\textsf{\oldstylenums{1234567890}}
\end{document}
In XeLaTeX and LuaLaTeX it is much simpler. fontspec
changes the default font to Latin Modern anyways, so it is just a matter of adjusting the features for the Sans font (switching on demand with \oldstylenums
works as well).
\documentclass{article}
\usepackage{fontspec}
\setsansfont[Numbers=OldStyle]{Latin Modern Sans}
\begin{document}
\textsf{1234567890}
\end{document}
cfr-lm
: Note that I think \ostyle
and \texto{}
may be preferable to \oldstylenums
because they do not require an encoding switch. Also sf=oldstyle
does nothing because you'd get proportional oldstyle figures by default anyway.
– cfr
Feb 6 '16 at 4:20
\textpl{AB12 3DC}
for a UK postcode or US zip, if oldstyle figures are default for the document. (I use this a lot.) Because the fonts are there, there is no need to resort to the supplementary encoding to access these figures. You can just switch families temporarily, which I think is much more satisfactory. At least, I could be mistaken. But that's why I did it that way. Of course, I'm biased ;).
– cfr
Feb 6 '16 at 4:26
There are quite a few Opentype sans-serif font families out there that feature old-style numerals as an option. However, since they are Opentype fonts, you will need to use either XeLaTeX or LuaLaTeX to access them.
Not knowing anything about your document, I don't think it's helpful to recommend any particular sans-serif font. The following code shows ten different sans-serif fonts I found on my system that feature old-style numerals.
%% Compile with either XeLaTeX or LuaLaTeX
\documentclass{article}
\usepackage{fontspec,array}
\defaultfontfeatures{Numbers=OldStyle}
\newcommand{\doline}[1]{\setsansfont{#1}\sffamily#1\quad0123456789\par}
\begin{document}
\doline{Calibri}
\doline{Calibri Light}
\doline{Latin Modern Sans}
\doline{Linux Biolinum O}
\doline{Myriad Pro}
\doline{Optima nova LT Pro}
\doline{Palatino Sans Com}
\doline{Skia Regular}
\doline{TeX Gyre Heros}
\doline{Biome Std Semi Bold}
\end{document}
I recommend looking at http://www.tug.dk/FontCatalogue/sansseriffonts.html for more possibilities.
For the following fonts, no fontspec
is required, which means they compile in pdflatex.
Here is Alegreya Sans.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[sfdefault]{AlegreyaSans} %% Option 'black' gives heavier bold face
%% The 'sfdefault' option to make the base font sans serif
\renewcommand*\oldstylenums[1]{{\AlegreyaSansOsF #1}}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Carlito:
\documentclass{article}
\usepackage[sfdefault,lf]{carlito}
%% The 'lf' option for lining figures
%% The 'sfdefault' option to make the base font sans serif
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Fira Sans:
\documentclass{article}
\usepackage[sfdefault]{FiraSans} %% option 'sfdefault' activates Fira Sans as the default text font
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
GFS Neohellenic:
\documentclass{article}
\usepackage[default]{gfsneohellenic}
\usepackage[LGR,T1]{fontenc} %% LGR encoding is needed for loading the package gfsneohellenic
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Iwona:
\documentclass{article}
\usepackage[math]{iwona}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Iwona Condensed:
\documentclass{article}
\usepackage[condensed,math]{iwona}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Iwona Light:
\documentclass{article}
\usepackage[light,math]{iwona}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Iwona Light Condensed:
\documentclass{article}
\usepackage[light,condensed,math]{iwona}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
KP Sans Serif:
\documentclass{article}
\usepackage[sfmath]{kpfonts} %% sfmath option only to make math in sans serif. Probablye only for use when base font is sans serif.
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Kurier:
\documentclass{article}
\usepackage[math]{kurier}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}
Note that Kurier also offers versions in condensed, light, and light condensed (not shown here).
Mintspirit (only comes in OSF):
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[default]{mintspirit}
\begin{document}
0123456789 %vs \oldstylenums{0123456789}
\end{document}
Source Sans Pro:
\documentclass{article}
\usepackage[default]{sourcesanspro}
\usepackage[T1]{fontenc}
\begin{document}
0123456789 vs \oldstylenums{0123456789}
\end{document}