# Including empty lines in verbatim text in command environment

I am trying to typeset some text on an included pdf page with the pdfpage package. This can be easily done with the pagecommand={} option. But it seems we cannot insert an empty line inside the brackets. This is usually not a big deal. But it also stops me from including verbatim text which usually includes empty lines in the pagecommand. So how can I get over this?

\includepdf[pages={1}, pagecommand={
\begin{lstlisting}
Some text here

More text after an empty line
\end{lstlisting}
}]{file.pdf}


The above code would result in an error. And removing the empty line then everything would go through.

• no verbatim command works in the argument of any other command, loss of blank lines will only be one minto symptom, of your code listing uses any special tex forms such as \foo\bar they will be interpreted as tex not as verbatim code – David Carlisle Mar 1 at 8:09
• @DavidCarlisle Then is that to say there is really no way to typeset verbatim text on top of an included pdf page? – huangzonghao Mar 1 at 22:04
• the question though is unrelated to listings and pdflpages, you could ask about verbatim in \parbox for example, with the same solutions, for example save the text in a box using lrbox then use the box. – David Carlisle Mar 2 at 0:36