How do I make an item in a description list verbatim? \verb
in \item[]
seems to be not allowed:
\begin{description}
\item[\verb+list comprehension [f a | a <- M a]+] bla bla bla
\end{description}
descriptionlistsverbatim
How do I make an item in a description list verbatim? \verb
in \item[]
seems to be not allowed:
\begin{description}
\item[\verb+list comprehension [f a | a <- M a]+] bla bla bla
\end{description}
Best Answer
The package
examplep
provides several commands and environments for typesetting verbatim text. For instance, the robust commands\PVerb[options]{text}
and\Q{text}
can be used in macro arguments and in section titles as well.Code example for your description list:
Output:
See Verbatim phrases and listings in LaTeX by Péter Szabó (or
texdoc examplep
) for further information. Escaping special characters (for instance with\Q
) may be necessary as described in section 3.1 of the documentation.Note, T1 font encoding has to be use to get a proper < symbol because it's unavailable in standard OT1 encoding.