minted
minted copied to clipboard
`breaklines` causes different spacing with some `frame`s
\documentclass{article}
\usepackage{minted}
\begin{document}
\section*{lines}
\begin{minipage}{3cm}
\begin{minted}[frame=lines,breaklines=false]{C}
int main() {
return 0;
}
\end{minted}
\end{minipage}
\begin{minipage}{3cm}
\begin{minted}[frame=lines,breaklines=true]{C}
int main() {
return 0;
}
\end{minted}
\end{minipage}
\section*{single}
\begin{minipage}{3cm}
\begin{minted}[frame=single,breaklines=false]{C}
int main() {
return 0;
}
\end{minted}
\end{minipage}
\begin{minipage}{3cm}
\begin{minted}[frame=single,breaklines=true]{C}
int main() {
return 0;
}
\end{minted}
\end{minipage}
\end{document}
produces
Also with frame=none the spacing difference is present, but it's not so obvious by eye.
Reproducible with fvextra, which is one of the minted dependencies.
\documentclass{article}
\usepackage{fvextra}
\begin{document}
\begin{minipage}[t]{3cm}
\begin{Verbatim}[frame=lines, breaklines=false]
int main() {
return 0;
}
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{3cm}
\begin{Verbatim}[frame=lines, breaklines=true]
int main() {
return 0;
}
\end{Verbatim}
\end{minipage}
\end{document}
breaklines is implemented in fvextra. When breaklines=true, lines are put in \parbox to enable breaking. This is probably responsible for the changes in spacing around frames. It looks like the effect is primarily before the closing frame. The \parbox might also cause some changes in spacing before/after environments with no frames. Perhaps something like \@esphack is needed.