In my TeXworks (MikTeX 2.9) editor, the following file compiles correctly. But when I change sin-1(x) to sin^-1(x) the following error occurs. I thought TeXworks would treat sin^-1(x) just as a plain text if not inside amsmath delimiters $..$, \(...\) etc.:

! Missing $ inserted.
<inserted text> 
l.8 Ignore sin^
               -1(x) for typesetting

.text File:


This \(a^{4}\) is a test.
Ignore sin-1(x) for typesetting
Another \(a_3\) test.


This doesn't have anything to do with TeXworks, MikTeX, or Ams-TeX; the LaTeX compiler itself is throwing this error at you.

The issue is that LaTeX restricts the usage of some symbols that have a special meaning to the interpreter. For example, because % signals the beginning of a comment, if you want a percent sign in your document, you have to write it as \%. Similarly, you will also need to escape \, #, $, ^, &, ~, _, {, and } in text mode, because these all have special meanings.

Specifically, ^ means a superscript in math mode, so $a^2 + b^2 = c^2$ is OK, but the 5^{th} symphony will generate the same error you have, since ^ isn't allowed in textmode without being escaped.

To solve this problem, you have a couple options, depending on context and what you want it to look like.

  1. You can write sin\^{-1}(x) and keep everything in text mode.
  2. You can use \textsuperscript to get a superscript in text mode: sin\textsuperscript{-1}(x).
  3. You can put everything in math mode, where it works without issue: $\sin^{-1}(x)$. (Writing \sin instead of sin typesets it upright, which looks better.)
  4. If you want it written in monospace, use \verb+sin^-1(x)+.

Here's how each of these options looks in the final document. I personally prefer option 3.

enter image description here

  • Is \, #, $, ^, &, ~, _, {, and } a complete list of special characters in LaTeX that one need to escape in text mode? If not, could some please provide a link to such a list? Following post makes me to believe that this may indeed be the complete list. – nam Dec 25 '15 at 22:58
  • 1
    @nam: my reference was the Not So Short Guide to LaTeX, §1.3.2 (p. 5). – Arun Debray Dec 25 '15 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.