1

I am trying to comment out all Verbatim blocks that are generated from a jupyter notebook export to .tex

\documentclass{article}
\usepackage{verbatim} % for comment
\usepackage{fancyvrb}

\let\showVerbatim\Verbatim
\let\endshowVerbatim\endVerbatim
\def\Verbatim{\begin{comment} \showVerbatim}
\def\endVerbatim{\endshowVerbatim \end{comment}}

\begin{document}

\section{Intro}
Display this

\begin{Verbatim}
Don't display this
\end{Verbatim}

\end{document}

But this fails with:

Runaway argument? ! File ended while scanning use of \next

I have read the fancyvrb manual and there are some bits there (FVE@Verbatim & \FV@VerbatimEnd) that seem promising, but I have been unable to get any of them to work.

Thanks in advance.

w15p
  • 13

1 Answers1

1

The manual of verbatim states one has to use the “low level” calls:

\documentclass{article}
\usepackage{fancyvrb}
\usepackage{verbatim}

\renewenvironment{Verbatim}{\comment}{\endcomment}

\begin{document}

Some text above
\begin{Verbatim}
abc
def
ghi
\end{Verbatim}

Some text below

\end{document}
egreg
  • 1,121,712