2

I want to have breaklines with verbatim. For this I use:

\documentclass[12pt,a4paper]{article}

\usepackage{fancyvrb}
\usepackage{fvextra}

And I set my environment like this:

\begin{verbatim}[breaklines=true, breakanywhere=true]
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
\end{verbatim}

But my problem is that the option of verbatim is always interpreted as a text:

[breaklines=true, breakanywhere=true] 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

I do not understand what I am doing wrong... Can someone help me please? I also tried with spverbatim, but it does not work...

Best

2
  • 2
    These options apply to \begin{Verbatim} (with upper case V), not to \begin{verbatim}.
    – Marijn
    Oct 30, 2022 at 12:35
  • So simple... Thanks a lot!
    – Guillaume
    Oct 30, 2022 at 13:35

1 Answer 1

2

The package fancyvrb doesn't touch verbatim. The options can be given to Verbatim or any environment you define with \DefineVerbatimEnvironment or \RecustomVerbatimEnvironment.

You might do in your preamble

\RecustomVerbatimEnvironment{verbatim}{Verbatim}{}

and verbatim will behave exactly as Verbatim.

You might also take advantage of this features and do

\DefineVerbatimEnvironment{VerbatimBreak}{Verbatim}{
  breaklines=true, breakanywhere=true
}

so you can do

\begin{VerbatimBreak}
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
\end{VerbatimBreak}

in the document for those verbatim parts that need line breaks.

Or you can do

\fvsetup{breaklines=true,breakanywhere=true}

and all fancyvrb environments will allow line breaks anywhere.

You must log in to answer this question.

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