[Tex/LaTex] Remove blank lines in minted


Is it possible to remove blank (empty) lines in minted, and gobble multiple blank lines to a specified amount, like the emptylines option in listings?

% I want something like the emptylines option
int i = 0;

int i = 0;


Best Answer

The minted package uses fancyvrb behind the scenes. This package doesn't have a build-in facility to skip blank lines. It is possible to add a test to skip blank lines, for example

    \ifx\FV@Line\@empty % Test added here

Dealing with picking particular numbers of blank lines is more tricky: Id be tempted to simply go for listings or edit the code source rather than try to alter this.

Related Question