9

This is closely related to the OP with title "lining figures in tables and math, old style figures in text", and to the answer provided therein.

The following (semi)MWE is to be run with pdfLaTeX:

\documentclass[12pt]{memoir}

\usepackage{etoolbox}% I tried with \AfterEndPreamble
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}

\AfterEndPreamble{%
    \def\libertine@figurealign{}
    \libertineOsF
    \noindent% memoir indents at the very start 
}

\begin{document}
Text figures: 0123456789
\par\noindent
Math figures: $0123456789$
\end{document}

It leads to lining figures in math mode and text (oldstyle) figures in text mode, but only on the textblock and not so on the headers, where we still get lining figures, as can be seen in the numeral for the page number.

How can we get oldstyle figures on the headers, too?

2
  • 1
    It's not only headers, section titles also use lining figures with this setup
    – cgnieder
    Aug 18, 2013 at 10:05
  • @cgnieder: Which makes it even worse than I thought.
    – Marcos
    Aug 18, 2013 at 10:14

3 Answers 3

9

This seems to work:

\documentclass[12pt]{memoir}

\usepackage[T1]{fontenc}
\usepackage[oldstyle]{libertine}

\makeatletter
\renewcommand*\libertine@figurestyle{LF}
\makeatother

\usepackage[libertine]{newtxmath}

\makeatletter
\renewcommand*\libertine@figurestyle{OsF}
\makeatother

\begin{document}


\section{foo 123 bar}

Text figures: 0123456789 \textbf{0123456789}
\par\noindent
Math figures: $0123456789$

\end{document}

enter image description here

1
  • Yes, now it seems to be "fully right" ;-)
    – Marcos
    Aug 18, 2013 at 10:40
6

For the current newtxmath, don't use the osf option before \usepackage[libertine]{newtxmath} but add the following 4 lines immediately after:

\makeatletter
\def\libertine@figurestyle{OsF} %affects \libertine macro
\makeatother
\renewcommand*{\rmdefault}{LinuxLibertineT-OsF} % for normal text

It's in newtxdoc.pdf.

1
  • Ooops, ok, I'm using WinEdt and it couldn't find the doc file... This is one of those cases where you get more than one right answer. I had already marked cgnieder's before reading yours, though. Since none is simpler than the other, I'll stick with that, even though yours is of course valuable, too. Moreover, it is the official way to go. Thanks so much, too.
    – Marcos
    Aug 18, 2013 at 10:50
4

The package Libertine (as of the version published on february 11, 2014) provides the \useosf command, which, if used after loading the math font, sets old-style figures only for text (including headers).

\documentclass[12pt]{memoir}

\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}

\useosf

\begin{document}

\chapter{Chapter}

\section{Section}

Text figures: 0123456789
\par\noindent
Math figures: $0123456789$
\end{document}

enter image description here

0

You must log in to answer this question.

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