[Tex/LaTex] tabular numbers in tables, proportional in text


I'm using LuaTeX with a font that has proportional, lining and tabular numbers available.

Is it possible to set things up so tables automatically use tabular numbers – but proportional numbers are used in the text?

Best Answer

Yes, please provide an MWE so we know more about your specific situation. If for now we assume you're using fontspec like most people, what you're looking for is pretty easily done. I'd use the \AtBeginEnvironment from the etoolbox package to automatically invoke a font change at the begin of every tabular. This is a matter of just one line:

\AtBeginEnvironment{tabular}{\setmainfont[Numbers={OldStyle,Monospaced}]{Minion Pro}}

so, as figure style selection is already implemented in fontspec, there is no need for an additional package -- etoolbox is likely to get loaded by other common packages anyways (biblatex etc.). Here's the complete example:

\usepackage{fontspec, etoolbox}

\setmainfont[Numbers={OldStyle,Proportional}]{Minion Pro}

\AtBeginEnvironment{tabular}{\setmainfont[Numbers={OldStyle,Monospaced}]{Minion Pro}}




oldstyle tab figs

NB: besides its simplicity, another nice thing here is you can insert additional table formatting as well. E.g., I usually want my tables \footnotesize:

Related Question