# How to change the mathmode font v2

In a previous question here I basically asked how to change the default mathmode font to lmodern. I had a good answer but partial however, I was recommended to create another post to solve the issue. My problem is that the function created to change the font does only apply on text that is written in exponent or index like below in the image but not on the text written on a normal line. How do we solve this ? I don't want the default mathmode font at all when i type text in any math environments.

\documentclass{article}

\usepackage{lmodern}
\everymath{\fam=0\relax}

\begin{document}

zzz $something_{anything}^{anything}$

\end{document}


This effectively adds \mathrm{...} around every math formula.

• Nice thanks, if i want to type a formula with \equation environment it goes back to standard mathmode font. I finally understand that i just have to type \rm in the environnment to get out of this. Thank you Feb 25 at 21:16
• \rm is not defined by default in latex, you can use \everydisplay as well as \everymath and set \fam in both. @BachirHassaine Feb 25 at 21:19
• thank you it's awesome Feb 26 at 22:39