1

Within a beamerarticle style I would like to have use of verbatim. I am using the package 'verbatimbox'. It seems as though together the two packages throw an error (based on the MWE below)

'Paragraph ended before \verbatim@start was complete.'

An output is generated but it does not display the verbatim line breaks nor spacing correctly.

Searching on this site I came across the idea of making the frame fragile, which of course works when you have a frame to make fragile. But I have no frame at this point.

Is there any way to have such a verbatim functionality?

Below is a fully stripped down MWE which is why I have no frames within a beamerarticle.

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{verbatimbox}

\begin{document}

\mode<article>{
text before

\begin{myverbbox}{\mybox}

first line
    second line

    third    line
    
\end{myverbbox}

\mybox

text after
}

\end{document}

1 Answer 1

2

Move the verbbox creation outside of the \mode macro. That is essentially what verbatimbox offers: the ability to create verbatim material in safe locations in your document, and then use the material in places were verbatim would otherwise be precluded.

\documentclass{article}
\usepackage{beamerarticle}
\usepackage{verbatimbox}

\begin{document}
\begin{myverbbox}{\mybox}

first line
    second line

    third    line
    
\end{myverbbox}

\mode<article>{
text before

\mybox

text after
}

\end{document}

enter image description here

2
  • This makes sense. Many thanks!
    – Geoff
    Nov 6, 2020 at 16:30
  • 1
    @Geoff Just remember that, as a general rule, you can not invoke verbatim creation inside of a macro argument. The reason is that the argument content is tokenized using the current catcodes (at the moment the macro is invoked), whereas verbatim needs to change the catcodes of its input stream. Nov 6, 2020 at 16:47

You must log in to answer this question.

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