I've been using the listings package with the following setup to produce a compact layout of code samples:


How would one control the top and bottom margins for minted? It doesn't have the same options.

  • Possibly you are looking for this: tex.stackexchange.com/q/228058/120578. If it solves your problem, please tell us to mark as a duplicate.
    – koleygr
    Nov 2, 2018 at 14:05
  • I think my problem is different because I'm not using any background colors. Nov 2, 2018 at 19:17
  • Check the answer please
    – koleygr
    Nov 2, 2018 at 19:32
  • minted basically uses a slightly modified version of trivlist. By wrapping it with tcolorbox features might be the simplest way to achieve your needs.
    – egreg
    Nov 3, 2018 at 23:34

1 Answer 1


Check this:



\lipsum*[1] Some text

int main() {
printf("hello, world");
return 0;

Some text \lipsum*[2]

It is @user11232's answer from here but without background colors.


enter image description here

  • How would I use it to adjust the top and bottom margins? Nov 3, 2018 at 20:04
  • You are right... It didn't worked with changes... I edited... You can change \medskip to \bigskip or \smallskip.. or even \medskip\smallskip or \vspace{1cm} etc
    – koleygr
    Nov 3, 2018 at 20:17

You must log in to answer this question.

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