So I use a lot of subscripts, and it annoyed me that they were in italics! I didn't want to call \textrm{} every time in math mode, and there had to be a better way!
I found this stackexchange post which described exactly what I wanted to do and this was their solution:
I found this stackexchange post which described exactly what I wanted to do and this was their solution:
Unfortunately that redefines _ for ALL uses of it, including in file names etc. I had a lot of file names and folder that used that character, so that wasn't an option. Some more searching and I found:\catcode`_=\active \newcommand_[1]{\ensuremath{\sb{\mathrm{#1}}}}
Which worked a charm! Now all my subscripts are automatically in roman font!\documentclass{article} \usepackage{amsmath}\let\sub_ \catcode`\_=12 \begingroup \catcode`\_=\active \gdef_#1{\sub{\text{#1}}} \endgroup \begin{document}
No comments:
Post a Comment