TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Was wondering how do you do that?

share|improve this question
up vote 13 down vote accepted

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

enter image description here

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

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|.}
share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.