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

Vsevolod Krishchenko crpg at aha.ru
Mon Feb 15 00:12:35 CET 2010


I have reproduced the following problem in Debian and Gentoo, so I believe it 
is an 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'.

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'
\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{listings}
\lstset{
numbers=left,
stepnumber=1
}
\begin{document} % this is a line number 9, not 1!
\lstinputlisting[firstline=9, lastline=11, language=TeX]{test01.tex}
\end{document}
======================

Debian bug #569576.

-- 
Vsevolod


More information about the tex-live mailing list