I recently had to reinstall my tex environment (texlive under windows), and afterwards I got lots of "Missing { [or }] inserted" errors. I managed to track the cause down to the use of \texttt within subscript. More precisely, using pdflatex on the following minimal example


gives me the following errors:

Missing { inserted. $A_\texttt
Missing } inserted. $A_\texttt{a}$

I guess something must have gone wrong with the fonts, but I can't figure out what.

By the way, for this small example the pdf file is created correctly, but for larger files pdflatex aborts.

Any suggestions?

  • Do you have a reason for not writing either $A_{\texttt{a}}$ or $A_{\mathtt{a}}$?
    – Mico
    Commented Sep 1, 2020 at 16:39
  • 1
    Thanks for the tips. As for \mathtt{}, I'm actually using this string inside a command that can appear inside and outside of math mode, so I'd rather stick with \texttt. As for putting { } around it, I didn't know it was necessary. Any Idea why it worked previously, but not anymore?
    – Jan
    Commented Sep 1, 2020 at 16:45
  • 2
    it was never supported behaviour but because the parsing of _ is very odd it sometimes works anyway, but any redefinition of texttt is likely to break it again. if _ took it's argument like a macro the braces would be needed, \fbox\texttt{a} would be \fbox{\texttt}{a} and fail badly. Commented Sep 1, 2020 at 16:49
  • 1
    your example works in texlive 2018 but not 2019 or 2020 Commented Sep 1, 2020 at 16:53
  • That figures, my previous texlive installation was a few years old. OK, thanks to both of you, guess I'll have to rewrite a few commands...
    – Jan
    Commented Sep 1, 2020 at 16:55

1 Answer 1


The suggestion is to use


or, if you really prefer,


Beware, though, that in an italic context, the latter would print the subscript in italics.

The error you get is specific to beamer, because it juggles with fonts in order to get as much sans serif as possible. It wouldn't appear with article or other document classes.

Anyway, the syntax A_\texttt{a} has never been officially supported and complex subscript should always be braced.

Some examples are


The last example shows that not even a single token is safe. You can safely use unbraced a single letter or digit, with no formatting instruction. For symbols, use braces and you'll be OK. Hence


is good, whereas A_\mathrm{a} is bad, even if it appears to work.

You must log in to answer this question.

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