I use the following settings for code listings. \usepackage{listings} \usepackage{textcomp} \lstset{language=Java, keywordstyle=\color{RoyalBlue}, basicstyle=\scriptsize\ttfamily, commentstyle=\color{Green}\ttfamily, rulecolor=\color{black}, upquote=true, numbers=left, numberstyle=\tiny\color{gray}, stepnumber=1, numbersep=8pt, showstringspaces=false, breaklines=true, frameround=ftff, frame=single
![Adjust bottom margin of a listing environment](https://cdn-ak-scissors.b.st-hatena.com/image/square/5792ee9d97c6b73b14d30bea016d8e5c0793e345/height=288;version=1;width=512/https%3A%2F%2Fcdn.sstatic.net%2FSites%2Ftex%2FImg%2Fapple-touch-icon%402.png%3Fv%3Deaf26b461720)