3

i want to Write sub-and superscript in math mode but not italic.

 \documentclass[a4paper,11pt]{article}
        \usepackage{amsmath}
        \begin{document}
            % using mathmode sub- and supperscrit.
 \begin{equation}
\mathbf{M}^{T}
\end{equation}
\begin{equation}
\mathbf{M}_{xx}
\end{equation}
        % I can do it using /bf but it makes it is also bold.

        \begin{equation}
\bf{M}^{T}
\end{equation}

\begin{equation}
\bf{M}_{xx}
\end{equation}
        \end{document}
3
  • Have you tried \rm instead of \bf? Incidentally, you mention material in subscripts and superscripts; what about the material in the "normal" positions? Should that material be rendered in (math) bold automatically?
    – Mico
    Apr 26, 2016 at 16:04
  • (1) \bf is a switch, thus does not take arguments, (2) \bf switches to the text font, not wat you want, (3) either use \mathbf or (IMO better) load the bm package and use \bm{M} as it will be bold and italic mah font
    – daleif
    Apr 26, 2016 at 16:13
  • @Mico, infact it is equation environment.
    – user31177
    Apr 26, 2016 at 16:39

1 Answer 1

2

If you want to display material in sub- and superscripts using roman/upright rather than italic letters, you should render the main material (i.e., what's on the main math axis) using roman/upright letters as well.

One way to render all math material with upright letters on a document-wide basis is to load the mathastext package:

\usepackage{mathastext}

Another method for achieving this look on a document-wide basis would be to issue the instructions

\everymath{\rm}
\everydisplay{\rm}

in the preamble.

Addendum: The commands \bf and \rm are considered deprecated in LaTeX2e documents. They do happen to work -- more or less as one would expect they should work in a Plain-TeX document -- if one uses one of the "standard" LaTeX document classes (article, report, and book) or a document class that's based on one of the standard classes. If you use one of the Koma-Script document classes, though, you'll get a warning message. Finally, \bf and \rm aren't defined at all in the memoir document class. For general portability of one's code across document classes, the \bm and \rm macros shouldn't be used in a LaTeX document anymore.

9
  • \rm should warrant a downvote.
    – egreg
    Apr 26, 2016 at 16:40
  • 1
    @egreg - Why? As explained in more detail in this answer, the standard LaTeX classes define \rm as follows: \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}. Thus, \rm in math mode acts like \mathrm.
    – Mico
    Apr 26, 2016 at 16:47
  • Try that with memoir ;-)
    – daleif
    Apr 26, 2016 at 16:48
  • 1
    @daleif - The OP used the article class in the MWE. This made me think it's OK to use a definition of \rm that is provided by the article class.
    – Mico
    Apr 26, 2016 at 16:49
  • 1
    @daleif - \sc and \sl in math mode will generate a LaTeX warning, but \rm, \bf, \sf, \tt, and \it do not.
    – Mico
    Apr 26, 2016 at 16:55

You must log in to answer this question.

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