I use the following code to display line 23-45 of sort.cpp
:
\lstinputlisting[language=C++,linerange=23-45]{sort.cpp}
However, the line numbering starts with 1 while I want it start at 23. I found some reference that suggested to change this to
\lstinputlisting[language=C++,linerange=23-45,firstnumber=23]{sort.cpp}
It works, and I want this to be the default setting. According page 31 of the listings
documentation,
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.
It should be the default. What's wrong here, or am I misundersting the reference?
My listings setting:
\usepackage{xcolor,listings}%color support for listings
\lstset{
basicstyle=\footnotesize,
numbers=left,
numberstyle=\footnotesize,
keywordstyle=\color{blue!70},
commentstyle=\color{red!50!green!50!blue!50},
%stringstyle=\ttfamily, % typewriter type for strings
%frame=shadowbox,
rulesepcolor=\color{red!20!green!20!blue!20},
escapeinside=``,
xleftmargin=2em,xrightmargin=2em, aboveskip=1em,
breaklines=true % sets automatic line breaking
}