I am changing some Verbatim
blocks to BVerbatim
to avoid page breaks in the middle of some short source code examples:
\documentclass[a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}
\usepackage{listings}
\usepackage[scaled=.73]{beramono}
\fvset{baselinestretch=0.94}
\parindent=0pt
\parskip = 6pt
\lstset{
basicstyle=\linespread{0.94}\ttfamily,%
fancyvrb=true,%
}
\begin{document}
Before using Verbatim.
\begin{Verbatim}
foo
bar
\end{Verbatim}
After using Verbatim. \\ Before using BVerbatim.
\begin{BVerbatim}
foo
bar
\end{BVerbatim}
After using BVerbatim.
\end{document}
However, these two have different margin settings. BVerbatim
has less spacing before and after the code block:
How can I adjust BVerbatim
here so that it looks like Verbatim
?
Best Answer
Verbatim
uses an own paragraph for its contents, butBVerbatim
not. You can use:But there is no option to add vertical space at the end. You have to rewrite
\endBVerbatim
or to add\par
.