1

I'm writing my assignments in latex. Everything works cool, but time to time, when i press F1, a lot of errors occur. Like everything should be wrong even if I pressed F1 2 minutes ago. When I save the file with a new name in a new file, everything works again, as i should. Does anybody know where could be this weird problem of a random "rebellion" of LaTeX?

Example of one error

 ! Missing $ inserted.
<inserted text>
$
l.7 ... {1.2}_Historie e-knih}{10}{subsection.1.2}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Extra }, or forgotten $.
<argument> ...}{\numberline {1.2}_Historie e-knih}
\hyper@linkend
l.7 ... {1.2}_Historie e-knih}{10}{subsection.1.2}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

Example of errors

migrated from stackoverflow.com Jan 31 '18 at 21:48

This question came from our site for professional and enthusiast programmers.

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Martin Schröder Feb 1 '18 at 9:02
  • Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Feb 2 '18 at 17:20
3

That looks like you have an unescaped underscore in a section title. Underscores are not valid in text mode, pdflatex will assume you meant to be in math mode and then get confused when you don't seem to be exiting math mode.

This problem only occurs on the second run since it's not in your .tex source file, but in the .aux or .toc file, which are generated by the first run. When you save with a different file name, you generate new aux etc. files, which is why the problem seems to go away.

It's also possible that not all of the commands you use in your section title are what is called robust, which boils down to you can't have them in footnotes, section titles, etc. Try prepending \protect to those, that might help. (You will still need to delete the aux and toc files and compile twice.)

  • Thank you a lot! I deleted the underscores from titles, which I used just for my propre orientation and one more symbol caused harm to compiling - &, I just typed \ before, and voilá, it works. Thank you :) – Lenka Tom Jan 31 '18 at 16:47

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.