On 2015-05-29 Fri 21:32, Nick Dokos wrote: > Titus von der Malsburg writes: > >> #+BEGIN_EXAMPLE >> * The variable ~JAVA_HOME~ >> & >> #+END_EXAMPLE >> >> Exporting this to LaTeX and then compiling to PDF, produces the >> following error: >> >> ! Missing $ inserted. >> >> $ >> l.35 \section{The variable \verb~JAVA_HOME~} >> >> Apparently, \verb is not allow in command arguments: >> >> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=verbwithin >> >> One solution is uses \cprotect: >> >> \cprotect\section{The variable \verb~JAVA_HOME~} >> >> I don’t know how the exporter works but I wouldn’t be surprised if it >> wasn’t entirely trivial to implement this. >> >> The problem also exists in other situations where ~verbatim~ is used in >> embedded contexts, for example when used in link descriptions: >> >> [[https://encrypted.google.com/search?q=JAVA_HOME][Google >> ~JAVA_HOME~]] >> >> Is there anything that speaks against using \texttt for ~verbatim~? The >> HTML exporter uses the code tag for ~verbatim~ and =code=. >> >> Titus > > I don't know what \cprotect does but there was a discussion of this a > long time ago: > > http://thread.gmane.org/gmane.emacs.orgmode/14256/focus=14257 > > and back then, Carsten changed it so that verbatim in headlines used > \texttt - but that was the old latex exporter: I take it things are > different now? Yes, I saw this thread after sending the previous email. According to `org-latex-text-markup-alist', protectedtexttt should be used, which seems like a good-enough solution for this problem. But for some reason that doesn’t happen. BTW, I used the latest development versions of Emacs (-Q) and Org-mode to test this. Titus