--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: texlive-latex-recommended: listings package shows wrong line numbers in file listings
- From: Vsevolod Krishchenko <mstu@sevik.ru>
- Date: Fri, 12 Feb 2010 18:42:21 +0300
- Message-id: <20100212154221.5281.38267.reportbug@imac>
Package: texlive-latex-recommended
Version: 2009-7
Severity: important
In texlive-2007 (lenny) listings packages has typed a correct line number in a file listing.
For example, '\lstinputlisting[firstline=20, lastline=25]{..}' command starts numeration from '20'.
In texlive-2009 (squeeze), listing always starts with line number '1'.
For example, '\lstinputlisting[firstline=20, lastline=20]{..}' starts line numbers from '1'.
So, listing first line will have a number '1' but in fact it is a line number '20'.
Due to this bug, any document using 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.
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}
======================
-- Package-specific info:
If you report an error when running one of the TeX-related binaries
(latex, pdftex, metafont,...), or if the bug is related to bad or wrong
output, please include a MINIMAL example input file that produces the
error in your report. Don't forget to also include minimal examples of
other files that are needed, e.g. bibtex databases. Often it also helps
to include the logfile. Please, never send included pictures!
If your example file isn't short or produces more than one page of
output (except when multiple pages are needed to show the problem),
you can probably minimize it further. Instructions on how to do that
can be found at
http://www.latex-einfuehrung.de/mini-en.html (english)
or
http://www.latex-einfuehrung.de/mini.html (german)
##################################
minimal input file
##################################
other files
######################################
List of ls-R files
-rw-r--r-- 1 root root 1480 Feb 12 13:19 /var/lib/texmf/ls-R
-rw-rw-r-- 1 root staff 80 Feb 12 13:19 /usr/local/share/texmf/ls-R
lrwxrwxrwx 1 root root 29 Feb 12 13:06 /usr/share/texmf/ls-R -> /var/lib/texmf/ls-R-TEXMFMAIN
lrwxrwxrwx 1 root root 27 Feb 12 13:06 /usr/share/texmf-texlive/ls-R -> /var/lib/texmf/ls-R-TEXLIVE
lrwxrwxrwx 1 root root 27 Feb 12 13:06 /usr/share/texmf-texlive/ls-R -> /var/lib/texmf/ls-R-TEXLIVE
######################################
Config files
lrwxrwxrwx 1 root root 20 Feb 12 13:06 /usr/share/texmf/web2c/texmf.cnf -> /etc/texmf/texmf.cnf
-rw-r--r-- 1 root root 7640 Feb 12 13:19 /var/lib/texmf/web2c/fmtutil.cnf
-rw-r--r-- 1 root root 13909 Feb 12 13:19 /var/lib/texmf/web2c/updmap.cfg
-rw-r--r-- 1 root root 3608 Feb 12 13:19 /var/lib/texmf/tex/generic/config/language.dat
######################################
Files in /etc/texmf/web2c/
total 4
-rw-r--r-- 1 root root 283 Nov 10 2008 mktex.cnf
######################################
md5sums of texmf.d
3875bf0f4a53a29b7f247399dc9833e2 /etc/texmf/texmf.d/05TeXMF.cnf
6e82a3d4c00ae7e4f86aa8dcf9438cf3 /etc/texmf/texmf.d/15Plain.cnf
c60a084820a0b73e3bfbf2e90bda437c /etc/texmf/texmf.d/45TeXinputs.cnf
ea33127256c6a9f37145ae5b16fdb80c /etc/texmf/texmf.d/55Fonts.cnf
afccf1d3f87057411166a77c58e00bd1 /etc/texmf/texmf.d/65BibTeX.cnf
9da7c1c7b1eaf06f941af91f48a23068 /etc/texmf/texmf.d/75DviPS.cnf
7ae52efac46feb97010986e57877d12e /etc/texmf/texmf.d/80DVIPDFMx.cnf
055e06548bac99958d8ab2dd1248f2b4 /etc/texmf/texmf.d/80tex4ht.cnf
37329819f1109e8a457e64b8b58fecdb /etc/texmf/texmf.d/85Misc.cnf
a8952d594677235951d447665ec46e9c /etc/texmf/texmf.d/90TeXDoc.cnf
bab3b7e578107f999fa1b0768994f6f8 /etc/texmf/texmf.d/95NonPath.cnf
1df66bc319cec731e202eaf39f5d85e1 /etc/texmf/texmf.d/96JadeTeX.cnf
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages texlive-latex-recommended depends on:
ii dpkg 1.15.5.6 Debian package management system
ii tex-common 2.06 common infrastructure for building
ii texlive-binaries 2009-5 Binaries for TeX Live
ii texlive-common 2009-7 TeX Live: Base component
ii texlive-latex-base 2009-7 TeX Live: Basic LaTeX packages
Versions of packages texlive-latex-recommended recommends:
ii latex-beamer 3.07-2 LaTeX class to produce presentatio
ii latex-xcolor 2.11-1 Easy driver-independent TeX class
ii prosper 1.00.4+cvs.2007.05.01-4 LaTeX class for writing transparen
ii texlive-latex-re 2009-7 TeX Live: Documentation files for
texlive-latex-recommended suggests no packages.
Versions of packages tex-common depends on:
ii debconf [debconf-2.0] 1.5.28 Debian configuration management sy
ii dpkg 1.15.5.6 Debian package management system
ii ucf 3.0025 Update Configuration File: preserv
Versions of packages texlive-latex-recommended is related to:
pn tetex-base <none> (no description available)
pn tetex-bin <none> (no description available)
pn tetex-extra <none> (no description available)
ii tex-common 2.06 common infrastructure for building
-- debconf information excluded
--- End Message ---
--- Begin Message ---
- To: Vsevolod Krishchenko <mstu@sevik.ru>, 569576-done@bugs.debian.org
- Subject: Re: Bug#569576: texlive-latex-recommended: listings package shows wrong line numbers in file listings
- From: Norbert Preining <preining@logic.at>
- Date: Tue, 16 Feb 2010 09:52:35 +0100
- Message-id: <20100216085235.GF4981@gamma.logic.tuwien.ac.at>
- In-reply-to: <20100212154221.5281.38267.reportbug@imac>
- References: <20100212154221.5281.38267.reportbug@imac>
On Fr, 12 Feb 2010, Vsevolod Krishchenko wrote:
> In texlive-2007 (lenny) listings packages has typed a correct line number in a file listing.
> For example, '\lstinputlisting[firstline=20, lastline=25]{..}' command starts numeration from '20'.
>
> In texlive-2009 (squeeze), listing always starts with line number '1'.
> For example, '\lstinputlisting[firstline=20, lastline=20]{..}' starts line numbers from '1'.
> So, listing first line will have a number '1' but in fact it is a line number '20'.
Which is correct.
> Due to this bug, any document using partial file listing will have invalid listings line numbers after recompilation.
No this is not a bug.
Please read the documentation, I just *now* did it and found that
you are not using the package in the right way.
> % 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}
>From the documentaiton:
firstline=...
lastline=...
can be used on individual listings only. The given line ranges of the
listing are displayed. The intervals must be sorted and must not intersect.
There is *nothing* about the line*number* as printed!!!
If you read a bit on in the documentation you come to
4.8 Line numbers
and find:
firstnumber=...
auto lets the package choose the first number: a new listing starts with
number one, a named listing continues the most recent same-named listing
(see below), and a stand alone file begins with the number corresponding to
the first input line.
last continues the numbering of the most recent listing and number sets
it to the number.
So it clearly states that without any setting all listings start with
number 1, unless you use firstnumber=whatever.
So a simple solution is to
\lstinputlisting[firstnumber=9, firstline=9, lastline=11, language=TeX]{test01.tex}
Closing this bug.
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
------------------------------------------------------------------------
GLENTAGGART (n.)
A particular kind of tartan hold-all, made exclusive under licence for
British Airways. When waiting to collect your luggage from an airport
conveyor belt, you will notice that on the next conveyor belt a
solitary bag is going round and round uncollected. This is a
glentaggart, which has been placed there by the baggage-handling staff
to take your mind off the fact that your own luggage will shortly be
landing in Murmansk.
--- Douglas Adams, The Meaning of Liff
--- End Message ---