I have been using the listings
package to present my source code in LaTeX. However, I can't get the line numbers to continue between two separate user-defined listings that have been given the same name. For example, the following code just seems to start the line number at 1 for each listing block rather than sequentially numbering them:
\usepackage{listings}
\lstnewenvironment{bash}[1][]{
#1,
language = bash,
numbers = left,
firstnumber = auto}
\begin{document}
\begin{bash}[name=Test]
echo xyz
\end{bash}
\begin{bash}[name=Test]
echo xyz
\end{bash}
\end{document}
I'm aware I can set the number manually each time with \firstnumber = last
, but this kind of defeats the object of naming your listing. I presume I'm missing something here. Any help would be greatly appreciated.