Consider the following:


Compiling with pdflatex gives the error:

Runaway argument?
\end {document} 
! Paragraph ended before \next was complete.
<to be read again> 
  • 2
    This is defined as the age-old problem of trying to pass verbatim content as a macro argument, which requires special treatment. Perhaps you could elaborate on what you're after really.
    – Werner
    Apr 23, 2013 at 19:12
  • I want to make an environment for red verbatim text.. Apr 23, 2013 at 19:18
  • 1
    With listings: \lstnewenvironment{vred}{<something before the verbatim part>}{<something after>}. This command also allows to add arguments the same way \newenvironment does.
    – cgnieder
    Apr 23, 2013 at 21:04

2 Answers 2


In this particular case the problem is a typical one: You can't pass verbatim content as an argument to another macro. This is indeed the case with using environ, since content is accumulated in the macro \BODY for processing later.

From the looks of your minimal example, it seems like you're after printing verbatim content using a specific colour (say red). For this I'd suggest defining a new verbatim environment with this specific quality/attribute. As such, fancyvrb can come in handy. Here's a MWE that illustrates this concept (taken, virtually verbatim, from the fancyvrb documentation (section 4.1.3 Customization of formatting, p 5 and 4.2.4 Personalized environments, p 18)):

enter image description here

\usepackage{fancyvrb,xcolor}% http://ctan.org/pkg/{fancyvrb,xcolor}
First verbatim line.
Second verbatim line.
  • 2
    Thank you! Could you pass a parameter (#1) to the environment such that before the red verbatim text we also insert a \subsection*{#1}.. (which should not be in red) ? Apr 23, 2013 at 19:33

Regarding my last comment to Werners answer, I found the following to work:

\begin{MyVerbatim}{A verbatim subsection}
 First verbatim line.
 Second verbatim line.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .