# How do you insert an inline verbatim?

I'm trying to add an inline verbatim into a \paragraph?

Was wondering how do you do that?

-
– Marco Daniel Dec 6 '11 at 18:36

You need a work-around, since verbatim text is not allowed as arguments to a macro in general. verbdef is one such work-around:

\documentclass{article}
\usepackage{verbdef}% http://ctan.org/pkg/verbdef
\verbdef{\vtext}{verb text}
\begin{document}
\paragraph{Here is some \vtext.}
\end{document}​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​


Similar functionality is provided by fancyvrb. You could also try cprotect:

\usepackage{cprotect}% http://ctan.org/pkg/cprotect
%...
\cprotect\paragraph{Here is some \verb|verb text|.}

-
hmmm... is there another way that I don't have to install the package? I know its rather trivial to install it but just wondering... I'm using MacTex distribution – chutsu Dec 6 '11 at 18:44
Most of these package should be distributed with MacTeX. Moreover, the provided sources shows how to install the package (under the "Getting it" heading). – Werner Dec 6 '11 at 18:48
Does verbdef support multiline statements? I'm getting Undefined control sequence } iff the second argument of ''\verbdef'' contains a line break. – Karl Richter Nov 30 '14 at 23:00
@KarlRichter: Off the cuff I would say yes. To get around that, you can store the content in a box, as in \newsavebox{\mybox}\begin{lrbox}{\mybox}\begin{verbatim} ... \end{verbatim}\end{lrbox} \usebox{\mybox}. But there are other packages you can use as well, like fancyvrb for example. – Werner Dec 1 '14 at 5:26