2

I am trying to use normal text in math mode but it is not working. Below is the error I get. I have included asmath

$ \textnormal{F_{prior}(LSTM)} $

Missing $ inserted.
<inserted text> 
                $
l.297 $ \textnormal{F_{prior}(LSTM)}
                                     $

2 Answers 2

6

Instead of $ \textnormal{F_{prior}(LSTM)} $ you should use $ \mathrm{F_{prior}(LSTM)} $, because subscripts need math mode.

5

With amsmath

$\text{F}_\text{prior}(\text{LSTM})$

if you want the text font.

6
  • Please don't encourage users to do this, it is wrong on all levels, even the _\text is bad for users.
    – daleif
    Commented Dec 26, 2017 at 7:54
  • Because users may think this is a general feature, that they do not need braces, so it confuses them that sometimes they need braces other times they don't. Especially when it is coming from a high level user (many points), new users will take their examples as law.
    – daleif
    Commented Dec 26, 2017 at 10:24
  • Also, noone have ever guaranteed that that fact that you can use _\text does not mean that it will keep working for ever. So using braces is safer in general.
    – daleif
    Commented Dec 26, 2017 at 10:28
  • The use of text is wrong, it should never be used this way. This wrong use of text is on my top 3 of errors made by most users. Users should use one single construction, not one where they need to change things if the context it is used in turns out to be italic, for example. If you wrap your example in \enmph{...} all the text will be italic. Clearly not your intent. Users should use mathrm for stuff that are math (here at least the F) and for example textnormal for things that are clearly textual (not math), here prior is a candidate.
    – daleif
    Commented Dec 26, 2017 at 11:46
  • That is an example of the effect. Think used inside a theorem environment. Text is for textual comments in math, none of these are comments and thus specific markup should be used. Even if the op is asking for text font, using textnormal on each component instead of text is more stable in all situations.
    – daleif
    Commented Dec 26, 2017 at 12:10

You must log in to answer this question.

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