kosmikus / lhs2tex

Preprocessor for typesetting Haskell sources with LaTeX
Other
99 stars 28 forks source link

Underscore in a comment breaks the generated LaTeX code #25

Closed spockz closed 11 years ago

spockz commented 11 years ago

When using an underscore in a comment latex fails with the following error:

! Missing $ inserted.
<inserted text> 
                $
l.275 \end{hscode}
                  \resethooks
? ^D
! Emergency stop.
<inserted text> 
                $
l.275 \end{hscode}
                  \resethooks

This can be achieved with the following example. Also in gist.

\documentclass{article}
%include polycode.fmt
%if False
\begin{code}
module Main where
\end{code}
%endif
\begin{document}
\begin{code}
main = do
  -- comment with _
  print "Hello World"
\end{code}
\end{document}
kosmikus commented 11 years ago

This should really be an FAQ. Comments are (TeX) text, not code. Underscore has special meaning in TeX. So no bug.