LaTeX forum ⇒ Text FormattingEnforcing lining Figures for Math Mode and Tables Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Bob_the_Topper
Posts: 15
Joined: Thu May 03, 2012 4:54 pm

Enforcing lining Figures for Math Mode and Tables

Postby Bob_the_Topper » Sat Apr 20, 2013 7:44 pm

Hi!

I use cfr-lm to get oldstyle figures for regular text but they look bad in tables. Of course I could switch to lining figures manually (\lstyle or \textl) every single time but this is quite tedious. Also, lining figures are used automatically in math mode. Is there a way to enforce lining figures in tables too?

MWE:
  1. \documentclass{article}
  2.  
  3. \usepackage[%
  4. rm={oldstyle,proportional},%
  5. sf={oldstyle,proportional},%
  6. tt={oldstyle=false,proportional=false,monowidth}%
  7. ] {cfr-lm}
  8.  
  9. \begin{document}
  10. Old style numerals (0123456789) look great in normal text, but sometimes lining figures (\textl{0123456789}) are more appropriate. For example in mathematical contexts, old style is just out of place ($123 + 456 \neq 789$).
  11.  
  12. In tables, too, old style figures look bad:
  13. \begin{tabular}{l|r}
  14. Name & Age \\
  15. \hline
  16. A & 12 \\
  17. B & 23 \\
  18. C & 64 \\
  19. D & 67
  20. \end{tabular}
  21.  
  22. Lining figures are much better, but have to be set manually:
  23. {
  24. \lstyle
  25. \begin{tabular}{l|r}
  26. Name & Age \\
  27. \hline
  28. A & 12 \\
  29. B & 23 \\
  30. C & 64 \\
  31. D & 67
  32. \end{tabular}
  33. }
  34.  
  35. \end{document}

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
cgnieder
Site Moderator
Posts: 1948
Joined: Sat Apr 16, 2011 7:27 pm
Location: Germany
Contact:

Postby cgnieder » Sun Apr 21, 2013 11:36 am

You could use etoolbox to add lining figures to the {tabular} environment by adding these lines to your preamble:

  1. \usepackage{etoolbox}
  2. \AtBeginEnvironment{tabular}{\lstyle}


Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

Bob_the_Topper
Posts: 15
Joined: Thu May 03, 2012 4:54 pm

Postby Bob_the_Topper » Sun Apr 21, 2013 1:02 pm

Works like a charm :)
Thanks!

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 4 guests