Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here is my problem: I would like, as in some old maths books, use oldstyle figures as coefficients in math formulae – say in display- and textstyle, but lining figures for indices and exponents – say in script- and scriptscriptstyle. I'm not sure this is strictly equivalent, though. I guess that the use of the \mathchoice command would be useful, but I really don't know how to use it.

Does anyone know how to achieve this automatically?

Added: I forgot to say that a solution should work with any math font. It happens that the proposed solution, which works perfectly well with default TeX math fonts doesn't work with MinionPro. Maybe a specific problem of MinionPro?

share|improve this question
    
My solution works with all math fonts that define \mathnormal and have oldstyle digits in that font. As far as I know, MinionPro is not a math font. Without an example of what you're doing, it's impossible to tell. –  egreg Sep 10 '13 at 19:42

1 Answer 1

I wouldn't do it. Old books are not always examples of good typography.

\documentclass{article}

\makeatletter
\def\changedigit#1{%
  \begingroup\lccode`~=`#1\lowercase{\endgroup
    \edef~}{{\mathchoice
      {\noexpand\mathnormal{\mathchar\the\mathcode`#1}}
      {\noexpand\mathnormal{\mathchar\the\mathcode`#1}}
      {\mathchar\the\mathcode`#1}
      {\mathchar\the\mathcode`#1}
    }}
  \AtBeginDocument{\mathcode`#1=\string"8000 }
}
\@for\next:=1,2,3,4,5,6,7,8,9,0\do{\expandafter\changedigit\next}
\let\changedigit\@undefined
\makeatother

\begin{document}

$1234567890^{1234567890}$

$10x_0 + 11y_1$

\end{document}

enter image description here

You might want to add \scriptscriptstyle in the third argument to \mathchoice, which would give

enter image description here

or play with \DeclareMathSizes (see http://tex.stackexchange.com/a/58144/4427)

If you want to have all digits always oldstyle, change the code between \makeatletter and \makeatother into

\makeatletter
\@for\next:=1,2,3,4,5,6,7,8,9,0\do{%
  \begingroup\edef\x{%
    \mathcode`\next=\noexpand\number\numexpr\mathcode`\next-"7000+"100\relax}%
    \edef\x{\endgroup\x}\x
}
\makeatother

enter image description here

Of course, this last code can be substituted with

\DeclareMathSymbol{0}{\mathord}{letters}{`0}

and similar lines for the other digits.

share|improve this answer
1  
you might try this as a "good bad example": $10x_0 + 11y_1$ –  barbara beeton Sep 10 '13 at 16:04
    
@barbarabeeton WOW! ;-) –  egreg Sep 10 '13 at 16:06
    
hmmm. now that i see the result, i think $3z_3$ or $9z_9$ would add some "interest". the likelihood that this combination of styles might be applied to material with pre-scripts is pretty low, but that could inject even more possible ambiguity. –  barbara beeton Sep 10 '13 at 16:52
    
@bernard Note that I changed the code (the digit 8 was missing). Try the input proposed by barbara and you'll see why I consider this bad style. –  egreg Sep 10 '13 at 16:56
    
one place where old-style figures are good in "math" is in tables with long strings of numbers, or the expansion of a numerical representation of $\pi$. the varying shapes helps keep one from "getting lost". but be sure (in tables) to use digits with uniform widths. in the "text" form of digits, some (such as "1") are naturally narrower. –  barbara beeton Sep 10 '13 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.