The libertine
package per default has the options lining
and tabular
activated. In normal text you usually want proportional
and oldstyle
, though.
\usepackage[oldstyle,proportional]{libertine}
You don't want to set them as package options, though, but only after newtxmath
has been loaded to get lining figures in math. This could be done by defining \libertine@figurealign
to an empty definition (with pdfLaTeX) or to Proportional
(with XeLaTeX or LuaLaTeX) and call \libertineOsF
afterwards:
\usepackage{libertine}
\usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
\makeatletter
\AtBeginDocument{\def\libertine@figurealign{}\libertineOsF}
\makeatother
If you now want that mhchem
has lining numbers in text mode, too, you have to set its font option:
\mhchemoptions{textfontcommand=\libertineLF}
In a table you usually want libertine
's defaults back. That could be done by redefining \libertine@figurealign
to T
(it's definition is empty for proportional figures) when compiling with pdfLaTeX or to Monospaced
(vs. Proportional
) with XeLaTeX or LuaLaTeX, and calling the switch \libertineLF
afterwards. For convenience one could define a command \libertineTabular
:
\makeatletter
\newcommand\libertineTabular{\def\libertine@figurealign{T}\libertineLF}
\makeatother
This newly defined command should be only used inside the {table}
environment or, to be more precise, locally if you don't want to switch to tabular
figures for the whole document.
\documentclass[a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{textcomp}
\usepackage{amsmath, amsthm}
\usepackage{libertine}
\usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
\usepackage[version=4]{mhchem}
\mhchemoptions{textfontcommand=\libertineLF}
\makeatletter
\AtBeginDocument{\def\libertine@figurealign{}\libertineOsF}
\newcommand\libertineTabular{\def\libertine@figurealign{T}\libertineLF}
\makeatother
\begin{document}
Old style numbers belong in text 0123456789. \ce{C6H12O6 + 6O2 -> 6CO2 ^ + 6H2O ^ + \text{heat} ^}
Not in equations:
\begin{equation}
\ce{C6H12O6 + 6O2 -> 6CO2 ^ + 6H2O ^ + \text{heat} ^}
\end{equation}
Nor in tables.
\begin{table}[!htb]
\caption{mean, median and standard deviation}
\label{tab:mean}\libertineTabular
\begin{tabulary}{\textwidth} {LCCCCR}
\toprule
climate & species & mean & median & standard deviation & number of experiments \\
\midrule
1 & \textit{Picea abies} & 20,3699 & 20,0335 & 4,453 & 30 \\
2 & \textit{Picea abies} & 23,9864 & 12,6398 & 7,236 & 98 \\
\bottomrule
\end{tabulary}
\end{table}
\[ a^2 + b^2 = c^2 \qquad 1234567890 \]
Old style numbers belong in text 0123456789.
\end{document}
mhchem
's formulas:\mhchemoptions{textfontcommand=\libertineLF}