Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

Was wondering how do you do that?

share|improve this question
add comment

1 Answer

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

\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|.}
share|improve this answer
2  
You beat me by 3 seconds. :-) –  lockstep Dec 6 '11 at 18:35
    
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
2  
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
add comment

Your Answer

 
discard

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.