1

I have some extra vertical space in my listings/minted code snippet that I can't figure out how to get rid of (especially the bottom). The code originally came from this answer. I have read the documentation, but can't seem to figure out where the padding is coming from (tcolorbox, listings, minted?)

How can I remove this padding, or at least make it even?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{minted}
\usepackage{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{listings, minted, skins}

\tcbset{listing engine=minted}

\newtcblisting{mlisting}{listing only, minted language=text, minted style=paraiso-dark,
    colback=bg, enhanced, frame hidden, minted options={ 
    fontsize=\footnotesize, breaklines, formatcom=\color{white}}}

\definecolor{inline}{RGB}{187,57,82}
\definecolor{bg}{RGB}{22,43,58}
\setminted[java]{bgcolor=bg, fontfamily=fdm, fontsize=\footnotesize}

\begin{document}

\begin{mlisting}
    some text
\end{mlisting}

\end{document}

output

1
  • I don't know why but removing formatcom=\color{white} fixes the extra padding. For your example, colupper=white sets text color to white and won't cause extra padding. Mar 1, 2022 at 5:12

1 Answer 1

0

muzimuzhi found the answer an hour earlier than I could (should watch my notifications more). I would have commented or upvoted on the comment, but I have no reputation.

For whatever reason, formatcom=\color{white} causes the erroneous spacing. However, the colupper they mention is actually a tcolorbox option, not a minted option. Works like a charm, though!

Thank you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .