Added command to allow pausing and continuing numbering in listing environments
This commit is contained in:
parent
aa57b252bb
commit
8234f36278
@ -163,6 +163,7 @@
|
||||
\captionsetup{labelformat=algocaption,labelsep=colon}
|
||||
\lstset{
|
||||
mathescape=true,
|
||||
escapeinside=||,
|
||||
frame=tB,
|
||||
numbers=left,
|
||||
numberstyle=\tiny,
|
||||
@ -178,5 +179,26 @@
|
||||
}
|
||||
{}
|
||||
|
||||
%
|
||||
% Allows for pausing and resuming the numbering in an lstlisting environment
|
||||
% Taken from https://tex.stackexchange.com/q/215697
|
||||
%
|
||||
|
||||
\let\origthelstnumber\thelstnumber
|
||||
\makeatletter
|
||||
\newcommand*\Suppressnumber{%
|
||||
\lst@AddToHook{OnNewLine}{%
|
||||
\let\thelstnumber\relax%
|
||||
\advance\c@lstnumber-\@ne\relax%
|
||||
}%
|
||||
}
|
||||
\newcommand*\Reactivatenumber{%
|
||||
\lst@AddToHook{OnNewLine}{%
|
||||
\let\thelstnumber\origthelstnumber%
|
||||
\advance\c@lstnumber\@ne\relax}%
|
||||
}
|
||||
\makeatother
|
||||
|
||||
|
||||
% For a way to add custom endings to acronyms see https://tex.stackexchange.com/a/268225
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user