I'm writing a math paper, and I want to change the style for the statement of theorems to \tt. However, I want this to affect things within math mode as well as normal text. Is there some way to force all math blocks within an environment to change style?
Asked
Active
Viewed 305 times
7
Joseph Wright
- 259,911
- 34
- 706
- 1,036
yrudoy
- 477
1 Answers
5
Here's one possible solution implementing the idea proposed by Marco Daniel in a comment; the solution uses:
- The
amsthmpackage to define a new theorem style to produce theorem-like structures with heading and body text in monospaced font. This style is used to define atheoenvironment. The
etoolboxpackage to append David Carlisle's answer to Can I change all math output to use monospaced text? to a hook executed by the\begincommand at the beginning of thetheoenvironmet.\documentclass{article} \usepackage{amsthm} \usepackage{etoolbox} \newtheoremstyle{monosp} {\topsep}{\topsep} {\ttfamily}{} {\ttfamily}{.\mbox{$ $}} {.5em}{} \theoremstyle{monosp} \newtheorem{theo}{Theorem} \AtBeginEnvironment{theo}{% \everymath{\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}} \everydisplay{\mathtt{\xdef\tmp{\fam\the\fam\relax}\aftergroup\tmp}} } \begin{document} Some test text $a=b$ and some in-line math $c=d$ and a displayed expression \[a=b\] just to test. \begin{theo} Some test text $a=b$ and some in-line math $c=d$ and a displayed expression \[a=b\] just to test. \end{theo} Some test text $a=b$ and some in-line math $c=d$ and a displayed expression \[a=b\] just to test. \end{document}

Gonzalo Medina
- 505,128
\everymathwhich can be redefined at the beginning of every theorem env. See: http://tex.stackexchange.com/questions/62978/can-i-change-all-math-output-to-use-monospaced-text – Marco Daniel Jul 25 '12 at 18:32\ttis deprecated – Joseph Wright Jul 25 '12 at 20:24