3

How to make the text in \text to be automatically upright in a theorem environment?

For example, I want to use these codes to get the following effect:

\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}

\begin{document}
\begin{theorem}
  This is a theorem.
  \[ F_\text{left}=F_\text{right} \]
\end{theorem}
\end{document}

enter image description here

(Actually, I use \textup to get this effect here.)

Update: The question Which command should I use for textual subscripts in math mode? may be helpful.

stone-zeng
  • 2,710
  • Most likely you need a theoremstyle and \upshape, but this is untested –  Jul 12 '17 at 16:09
  • I mean that the normal text should be still italic, but in math mode, the text to be upright. In my example, "This is a theorem" is italic, where "left" and "right" is upright. – stone-zeng Jul 12 '17 at 16:33
  • 2
    As you can see this is not the intended use for the \text command. It should be used for textual comments in displayed math, nothing else. Sadly many users misuse it like this. \textup or \textnormal is this correct choice in this case. – daleif Jul 12 '17 at 16:36
  • But I think the "left" and "right" here are just textual comments. What I want is that a simple F_\text{left} can have the same effect with F_\text{\upshape left}. – stone-zeng Jul 12 '17 at 16:53
  • 1
    The macro \textup is exactly what you should use; or, even better, \mathrm for single words. – egreg Jul 12 '17 at 19:28
  • @egreg So can you give an example of when to use \text? – stone-zeng Jul 13 '17 at 03:05
  • 1
    These are not textual comments, they are named indices. They always have to be upright, and \text is allowed to be italic when the context is italic, thus should clearly not be used for textual indices. – daleif Jul 13 '17 at 05:28
  • 2
    Example of correct use: f(x) =1 \qquad\text{for all $x>5$}. Here for all should match the surrounding text it should not be always upright. The fact that it follows the surrounding text also explains why you should not use \text{Log} for a function name. – daleif Jul 13 '17 at 05:34

0 Answers0