# Reduce the height of empty lines in \lstinputlisting

I am using \lstinputlisting to present some of my code in a paper. As shown in this image:

I intend to add empty lines between different parts of codes. However, I somehow want to reduce the height of these empty lines since they are occupying too much space.

Is there any way that I can control the height only for the empty lines by config the \lstset?

• Welcome to TeX.SE!. Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Cragfelt Nov 30 '17 at 22:01

There is a hook that you can use:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\begin{document}
\begin{lstlisting}
abc
abc

abc
\end{lstlisting}

\makeatletter