TransWikia.com

beamerarticle and verbatim: how to make fragile?

TeX - LaTeX Asked by Geoff on December 29, 2020

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}

One Answer

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

Correct answer by Steven B. Segletes on December 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP