I use minted
in following way:
\documentclass[a4paper, 11pt, twoside]{article}
\usepackage{xltxtra}
\usepackage{xunicode}
\usepackage{polyglossia}
\usepackage[svgnames]{xcolor}
% Syntax higlight
\usepackage{minted}
\usemintedstyle{vim}
\newminted{bash}{bgcolor=Beige, fontfamily=tt,
gobble=2, linenos, numbersep=-3pt}
\newmint{bash}{}
\renewcommand{\theFancyVerbLine}{
\sffamily
\textcolor{BlueViolet}{
\scriptsize
\oldstylenums{
\arabic{FancyVerbLine}
}
}
}
\begin{document}
AAAA
\begin{bashcode}
BBBB
CCCC
\end{bashcode}
DDDD
\begin{bashcode}
EEEE
FFFF
\end{bashcode}
GGGG
\end{document}
With this settings I have separate line number for each code block, i.e.
1 AAAA
2 BBBB
and later
1 EEEE
2 FFFF
I'd like to get continuous all the time increasing line numbers, i.e.
1 AAAA
2 BBBB
and later
3 EEEE
4 FFFF
According to fancyvrb
documentation I tried to add option firstnumber=last
to \newminted
definition, but it produces totally weird numbers, e.g. first code block starts with 16 and ends with 32, next starts with 43…
Best Answer
It looks like you are using
minted
1.7 or earlier. Version 2.0 and later includes patches for somefancyvrb
bugs. This should makefirstnumber=last
work correctly. (At least, it works for me.) Also, since 2.0 there is a package optionlanglinenos
that does per-language line numbering whenfirstnumber=last
, so that you can keepbash
line numbers separate from any other code.If this doesn't work for you with
minted
2.0+, then there is probably a bug inminted
.