I could run the program without any problem while highlighting few lines of code using listings
and lstlinebgrd
packages. But the recent update of listings
package v1.7 is giving me error even on the earlier working programs. For example, this program here. I am giving a similar program, but this time, in beamer.
\documentclass{beamer}
\usepackage{xcolor,listings, lstlinebgrd}
% \makeatletter
% \let\old@lstKV@SwitchCases\lstKV@SwitchCases
% \def\lstKV@SwitchCases#1#2#3{}
% \makeatother
% \usepackage{lstlinebgrd}
% \makeatletter
% \let\lstKV@SwitchCases\old@lstKV@SwitchCases
%
% \lst@Key{numbers}{none}{%
% \def\lst@PlaceNumber{\lst@linebgrd}%
% \lstKV@SwitchCases{#1}%
% {none:\\%
% left:\def\lst@PlaceNumber{\llap{\normalfont
% \lst@numberstyle{\thelstnumber}\kern\lst@numbersep}\lst@linebgrd}\\%
% right:\def\lst@PlaceNumber{\rlap{\normalfont
% \kern\linewidth \kern\lst@numbersep
% \lst@numberstyle{\thelstnumber}}\lst@linebgrd}%
% }{\PackageError{Listings}{Numbers #1 unknown}\@ehc}}
% \makeatother
\begin{document}
\begin{frame}[fragile]{Problem}
Test programme:
\begin{lstlisting}[language=C, gobble=6, linebackgroundcolor={%
\btLstHL<1>{1,3,5-6}%
\btLstHL<2>{4}%
}]
#include <stdio.h>
int main(void) {%
printf("Hello World!");
return 0;
}
\end{lstlisting}
\end{frame}
\end{document}
Both give same error as
! Package Listings Error: Numbers none unknown.
See the Listings package documentation for explanation.
Type H <return> for immediate help.
...
l.36 ...Error{Listings}{Numbers #1 unknown}\@ehc}}
Is there any work around? May be the lstlinebgrd package
author can give me some work around in case if there is no solution at the moment. I am sorry for reporting/posting issues with recent updates.
\documentclass{article} \usepackage{listings} \usepackage{lstlinebgrd} \begin{document} \begin{lstlisting} Lorem \end{lstlisting} \end{document}
.listings
recently changed some internals, maybelstlinebgrd
relied on them and broke.lstlinebgrd
was created from this post here. lstlisting works fine withoutlstlinebgrd
package, however, I would like to have few lines of code highlighted which I used to achieve using lstlinebgrd package earlier.listings
moved from&
to:
in\lstKV@SwitchCases
. This is whatlstlinebgrd
should do as well. Contact the package maintainer.