You can use formatting in headlines in org-mode. For example:

* Behavior of the _insert_ operation

This exports to PDF just fine.

If, however, your formatting is code formatting

* Behavior of the ~insert~ operation

, exporting it PDF results in an error message instead of a PDF:

org-latex-compile: PDF file built_files_ignored_by_git_tex/a.pdf wasn't produced: [undefined control sequence] Runaway argument

Within Emacs, the formatting is displayed correctly.

Is this a bug? Is there something a user can do to make the PDF build correctly?

I use GNU Emacs 24.5.1 and (according to what's written to the pdfcreator tag in the exported LaTeX document) org-mode 8.2.10.

  • Your example exports to LaTeX as \section{Behavior of the \texttt{insert} operation}, and export to PDF works fine here. How does your export to LaTeX look like? EDIT: This should include any header arguments or other LaTeX code as Runaway argument usually indicates a missing closed bracket. Commented Aug 27, 2017 at 20:34
  • 1
    For me, it exports to \section{Behavior of the \verb~insert~ operation}. I added the version of Emacs I use to the question. Here is the entire LaTeX file created on export: pastebin.com/9rreiGNz I substituted my name by <my name>. Everything else is unchanged.
    – UTF-8
    Commented Aug 27, 2017 at 21:39
  • Your example doesn't compile for me, the culprit being \verb. Somehow pdflatex doesn't recognize the ~ as the separators and interprets them as a command. Can you upgrade your version of org to a more recent one? The exporter now seems to favour \texttt now. Commented Aug 28, 2017 at 6:28
  • It worked! Thank you! Want to post this as an answer?
    – UTF-8
    Commented Aug 28, 2017 at 11:15

1 Answer 1


Upgrade your version of org-mode. Recent versions use \texttt instead of \verb. \verb allows you to choose a separator such as + or | to denote the text part. While ~ should also work, here it does not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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