I want to use the minted package to give me syntax highlighting but it has a spacing of more than a centimeter.
Setting:
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
does not help at all. Is there any way to reduce the spacing from the rest of the text?
minted internally uses the
Verbatimenvironment from the fancyvrb package. In the documentation of the implementation, the following formula for the spaces is given:And
Hence, setting
\partopsepto some other value does the trick; I’ve tried it, and you need a negative value to remove the margin:This removes most of the space between the text body and the code. To get a distance of 0.5cm, add its distance to that:
An implementation can be found in https://tex.stackexchange.com/a/19423