[texhax] Question about math fonts in LaTeX

Vafa Khalighi vafakhlgh at gmail.com
Thu Jan 20 18:27:17 CET 2011


>
> Here is a hackish solution:
>
> \documentclass{minimal}
> \usepackage{xparse}
> \DeclareSymbolFont{monospace}{OT1}{cmtt}{m}{n}
> \ExplSyntaxOn
> \cs_new_eq:NN \orig_mathbf:n \mathbf
> \RenewDocumentCommand \mathbf { m } {
>  \orig_mathbf:n {
>    \prg_stepwise_inline:nnnn { `0 } { \c_one } { `9 } {
>      \mathcode ##1 = \numexpr "100 * \symmonospace + ##1 \relax
>    }
>    #1
>  }
> }
> \ExplSyntaxOff
> \begin{document}
> $abc 012 \mathbf{abc 012} abc 012$
> \end{document}
>
>
>
I am not much familar with xparse. Can you tell me why this does not work:

 \documentclass{minimal}

\usepackage{xparse}

\DeclareSymbolFont{monospace}{OT1}{cmtt}{m}{n}

\newcommand{\test}[1]{%

\textbf{#1}

\ExplSyntaxOn

\cs_new_eq:NN \orig_mathbf:n \mathbf

\RenewDocumentCommand \mathbf { m } {

\orig_mathbf:n {

\prg_stepwise_inline:nnnn { `0 } { \c_one } { `9 } {

\mathcode ##1 = \numexpr "100 * \symmonospace + ##1 \relax

}

#1

}

}

\ExplSyntaxOff

}

\begin{document}

\test{test}

$abc 012 \mathbf{abc 012} abc 012$

\end{document}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110121/6de69d37/attachment.html>


More information about the texhax mailing list