I am using pandoc to convert Markdown to Tex, pandoc will render code blocks to \begin{verbatim}CODE\end{verbatim}
, and fvextra only works with \begin{Verbatim}[breaklines]
.
How can I make {verbatim}
to work as {Verbatim}[breaklines]
?
Redefine verbatim
to use fancyvrb
and fvextra
options.
\documentclass{article}
\usepackage{fvextra}
\RecustomVerbatimEnvironment{verbatim}{Verbatim}{breaklines}
\begin{document}
\begin{verbatim}
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
\end{verbatim}
\end{document}
Here is how to do it on LaTeX side:
\documentclass{article}
\usepackage{fvextra}
\renewenvironment{verbatim}{%
\VerbatimEnvironment
\begin{Verbatim}[breaklines]%
}{%
\end{Verbatim}%
}
\begin{document}
\begin{verbatim}
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
la$ la$ la$ la$ la$ la$ la$ la$ la$ la$ la$
\end{verbatim}
\end{document}
You only need to instruct pandoc to add these lines to preamble:
\renewenvironment{verbatim}{%
\VerbatimEnvironment
\begin{Verbatim}[breaklines]%
}{%
\end{Verbatim}%
}