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

Norbert Preining preining at logic.at
Tue Feb 16 09:55:11 CET 2010


On Mo, 15 Feb 2010, Vsevolod Krishchenko wrote:
> I have reproduced the following problem in Debian and Gentoo, so I believe it 
> is an upstream bug.

That bug has been closed now, it is wrong usage of the package.

a simple ...[firstnumber=9, ...] fixes it.

> 
> 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

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining            preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan            TU Wien, Austria           Debian TeX Task Force
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
KETTLENESS (adj.)
The quality of not being able to pee while being watched.
			--- Douglas Adams, The Meaning of Liff


More information about the tex-live mailing list