[tex-live] listings package: problem with line numbers

Vsevolod Krishchenko crpg at aha.ru
Mon Feb 15 13:54:32 CET 2010

I have reproduced the following problem in Debian and Gentoo, so I believe it 
is an up-upstream bug.

In Texlive 2007, listings packages has typed a correct line number within a 
file listing. For example, '\lstinputlisting[firstline=20, lastline=25]{..}' 
command starts numeration counting from '20'. This behaviour confirms 
documentation manual.

In Texlive 2009, listings package always starts counting from '1', ignoring 
'firstline'.  For example, '\lstinputlisting[firstline=20, lastline=20]{..}' 
starts line numbers from '1' instead of '20'. So, the listing first line will 
have a number '1' but in fact it is a line number '20'.

Due to this bug, a document included partial file listing will have invalid 
listings line numbers after recompilation. I have received no warning or error 
during 'pdflatex' run so this bug is a very unpleasant surprise.

The minimal example follows.

% File 'test01.tex'

\begin{document} % this is a line number 9, not 1!
\lstinputlisting[firstline=9, lastline=11, language=TeX]{test01.tex}

Debian bug #569576.


More information about the tex-live mailing list