views:

171

answers:

3

Hi,

is it possible to include a large block of a regex (like this one: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html) without escaping all colliding characters first?

i think of something like

\begin{following_section_will_not_be_parsed_by_latex} (a+?b) \end{...}

thank you!

Andrew

+1  A: 

Use a verbatim block. But it won't look very nice :(

Aaron Digulla
+2  A: 

Solved it!

you can include \usepackage{listings}

and then use \begin{lstlisting} [code|regex|whatever] \end{lstlisting}

thank you anyways,

Andrew

Andrew
verbatim is a little more lightweight than listings. But yes, both rely on turning LaTeX off for whatever happens inside the environment and turning it back on again afterwards.
Joey
+3  A: 

Look at fancyvrb package. From the README:

The `fancyvrb' package provides very sophisticated facilities for reading and writing verbatim TeX code. Users can perform common tasks like changing font family and size, numbering lines, framing code examples, colouring text and conditionally processing text.

So you can do something like:

\documentclass{article}
\usepackage{fancyvrb}
\begin{document}
\begin{Verbatim}[fontsize=\small,frame=single,label=RFC822 regexp]
...
\end{Verbatim}

In order to not clutter your Latex file with the huge regex, you can include a file verbatim as well.

Alok