[Tex/LaTex] way to use baskervald font and old style numbers for whole document

fontsoldstylenumspackages

Is there a way to use baskervald for text and old style numbers by default?

I want to avoid customizing each number set. Also I want to have text with proper typography.
I have a complete text of 138 pages in baskerville. When I try to apply old style numbers it changes numbers properly but pages goes up to 142 because of change in typography. What am I doing wrong/missing? Can't get it running without changing text font or size …

I was trying to use this template as reference: Utilizing oldstyle figures without resorting to \oldstylenums
, but with no success. And again with another example: How to make "old-style" the default for numerals?. With baskerville it all runs wrong.

I can't find where's the error in my big doc, perhaps order of package call…

My mwe looks something like this

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{kpfonts,baskervald}
\usepackage[sc,osf]{mathpazo}   % Palatino with pazo math fonts
%\usepackage{cfr-lm} % same result (delivers 140 pages)

\begin{document}
\textit{title}
\cleardoublepage
%content
%\input{138pages}
9876543210

abcdefghijklmnopqrstuvwxyz
\end{document} 

Summing up

  • Why isn't baskerville compatible with old style numbers?
  • How can I make a clone work properly? Is more than a .sty file required?

I assume these links could be relevant but can't figure how/why to put them to use:


Bottom line problem: the answers are useful to try but I can't quite move forward.

Best Answer

You can use Baskervaldx as a drop-in replacement for baskervald. From the docs:

The fonts included in this package are extensions and modifications of regular and bold weights of the baskervald fonts, which serve as a replacement for Baskerville. The changes provide small caps in all four styles, and a total of four ordinary figure types {tabular, proportional}x{lining, oldstyle} in each of those styles.

Borrowing some code from @Mico, here a solution for LuaLaTeX and/or pdfLaTeX:

\documentclass{article}
\usepackage{ifluatex}
\ifluatex
  \usepackage{fontspec}
  \fontspec{baskervaldx}
  \defaultfontfeatures+{Numbers={OldStyle,Proportional}}
  \setmainfont{baskervaldx}
\else
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage[osf,proportional]{Baskervaldx}
\fi

\def\test{%
9876543210\par
abcdefghijklmnopqrstuvwxyzäåàèéğłöőøřüß\par
\textsc{abcdefghijklmnopqrstuvwxyzäåàèéğłöőøřü}}

\begin{document}

\obeylines

Regular weight/upright
\test

\medskip
{\itshape Regular weight/italic
\test}

\medskip
{\bfseries Bold weight/upright
\test}

\medskip
{\bfseries\itshape Bold weight/italic
\test}

\end{document}

enter image description here