2

I am trying to typeset an old math paper that uses the text digits instead of the math digits in equations. E.g.

enter image description here

However, mathastext loads the math digits font from the baskervillef package in math environments by default. How can I change the default math digits font to the text digits font in math environments? Are there any solutions that do not require XeLaTeX?

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[p,osf]{baskervillef}
\usepackage[basic, frenchmath]{mathastext}

\begin{document}
Text digit: $i \neq n + \text{1}$

Math digit: $i \neq n + 1$
\end{document}

enter image description here

1 Answer 1

7

You can declare the text font as a Math symbol font, then set up the digits to use it

enter image description here

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[p,osf]{baskervillef}

\DeclareSymbolFont{digits}{T1}{BaskervilleF-OsF}{m}{n}
\DeclareMathSymbol{0}{\mathalpha}{digits}{`0}
\DeclareMathSymbol{1}{\mathalpha}{digits}{`1}
\DeclareMathSymbol{2}{\mathalpha}{digits}{`2}
\DeclareMathSymbol{3}{\mathalpha}{digits}{`3}
\DeclareMathSymbol{4}{\mathalpha}{digits}{`4}
\DeclareMathSymbol{5}{\mathalpha}{digits}{`5}
\DeclareMathSymbol{6}{\mathalpha}{digits}{`6}
\DeclareMathSymbol{7}{\mathalpha}{digits}{`7}
\DeclareMathSymbol{8}{\mathalpha}{digits}{`8}
\DeclareMathSymbol{9}{\mathalpha}{digits}{`9}

\usepackage{amsmath}

\begin{document}


Text digit: $i \neq n + \text{1}$

Math digit: $i \neq n + 1$
\end{document}
4
  • Can I do something similar with the text symbols? Say if I want to change the font of the text parantheses to another SymbolFont?
    – FR09
    Feb 3, 2022 at 12:21
  • yes you can do exactly the same except \( would be \mathopen not \mathalpha but perhaps you don't really want to change the digits to a new font perhaps what you really wanted to do was change the operator font to be that font, so then digits, () \log \mathrm{..} wold all use the text roman font. @FR09 Feb 3, 2022 at 12:28
  • Thank you for your help. However, what I wanted to ask is whether there is a command (similar to \DeclareMathSymbol) that is used to declare text symbols instead of math symbols.
    – FR09
    Feb 3, 2022 at 15:14
  • oh sorry no. There is not. @FR09 only by making characters active, but if you make digits active nothing will work Feb 3, 2022 at 15:21

You must log in to answer this question.

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