# Spacing between custom verbatim environments

I have a document that uses multiple custom verbatim environments, created using the fancyvrb package. Spacing around these is controlled by my own code; I have disabled the spacing added by fancyvrb using

\let\FV@ListVSpace\relax


However, when two verbatim environments appear inside an itemize (or other list environment), a vertical space is inserted between them.

\documentclass{article}
\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{}
\DefineVerbatimEnvironment{mapleerror}{Verbatim}{}

\begin{document}
\begin{itemize}
\item
Implied multiplication is not supported in Maple notation.
Omitting an asterisk will usually lead to an error message.
\medskip
\makeatletter
\let\FV@ListVSpace\relax
\makeatother
\begin{code}
2 sin( Pi ) ;
\end{code}
\begin{mapleerror}
Error, missing operator or ;
\end{mapleerror}
\end{itemize}
\end{document}


What causes the unwanted space, and how do I get rid of it?

You have to clear also the internal parameter \@topsepadd; better doing it in a group.

\documentclass{article}
\usepackage{fancyvrb}
\DefineVerbatimEnvironment{code}{Verbatim}{}
\DefineVerbatimEnvironment{mapleerror}{Verbatim}{}

\makeatletter
\newenvironment{tightcodes}
{}

\begin{document}
\begin{itemize}
\item
Implied multiplication is not supported in Maple notation.
Omitting an asterisk will usually lead to an error message.
\medskip
\begin{tightcodes}
\begin{code}
2 sin( Pi ) ;
\end{code}
\begin{mapleerror}
Error, missing operator or ;
\end{mapleerror}
\end{tightcodes}

\item Something else
\end{itemize}

\begin{tightcodes}
\begin{code}
2 sin( Pi ) ;
\end{code}
\begin{mapleerror}
Error, missing operator or ;
\end{mapleerror}
\end{tightcodes}

\end{document}