GeneralWhitespace added to Listing in PDF

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
stack
Posts: 1
Joined: Mon Feb 07, 2011 4:09 am

Whitespace added to Listing in PDF

Post by stack »

Hi,

it seems like there were always whitespace added to a listing in a PDF.
Is there a setting or parameter to remove them?
I read many posts about this problem, but found no solution.

In this post the first two pictures, also show the inserted whitespace (eg. import pl . edu . ju . spring):
http://www.latex-community.org/forum/vi ... =46&t=9390

In the minimal example, there were no whitespace added for the text outside the listing. Any suggestions?

Minimal Example:

Code: Select all

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{listings}
\usepackage{babel}

\begin{document}

\begin{lstlisting}[language=Java]
package com.example.hello;
\end{lstlisting}


package com.example.hello;
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply