Recent issues with lstlinebgrd package with listings after the latter's update [extension]












0















This question is in continuation of the earlier question in which it has been modified to include background color along with linebackground color in few lines of code. MWE is given below:



documentclass{beamer}

usepackage{listings, pgffor}

makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% btIfInRange{number}{range list}{TRUE}{FALSE}
%
% Test if int number <number> is element of a (comma separated) list of ranges
% (such as: {1,3-5,7,10-12,14}) and processes <TRUE> or <FALSE> respectively

newcountbt@rangea
newcountbt@rangeb

newcommandbtIfInRange[2]{%
globalletbt@inrange@secondoftwo%
edefbt@rangelist{#2}%
foreach range in bt@rangelist {%
afterassignmentbt@getrangeb%
bt@rangea=0rangerelax%
pgfmathtruncatemacroresult{ ( #1 >= bt@rangea) && (#1 <= bt@rangeb) }%
ifnumresult=1relax%
breakforeach%
globalletbt@inrange@firstoftwo%
fi%
}%
bt@inrange%
}%
newcommandbt@getrangeb{%
@ifnextcharrelax%
{bt@rangeb=bt@rangea}%
{@getrangeb}%
}%
def@getrangeb-#1relax{%
ifxrelax#1relax%
bt@rangeb=100000% maxdimen is too large for pgfmath
else%
bt@rangeb=#1relax%
fi%
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% btLstHL<overlay spec>{range list}
%
newcommand<>{btLstHL}[1]{%
only#2{btIfInRange{value{lstnumber}}{#1}{color{blue!30}}{}}%
}%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% btInputEmph<overlay spec>[listing options]{range list}{file name}
%
newcommand<>{btLstInputEmph}[3][empty]{%
only#4{%
lstset{linebackgroundcolor=btLstHL{#2}}%
lstinputlisting{#3}%
}% only
}%
makeatletter
letold@lstKV@SwitchCaseslstKV@SwitchCases
deflstKV@SwitchCases#1#2#3{}
makeatother
usepackage{lstlinebgrd}
makeatletter
letlstKV@SwitchCasesold@lstKV@SwitchCases
lst@Key{numbers}{none}{%
deflst@PlaceNumber{lst@linebgrd}%
lstKV@SwitchCases{#1}%
{none:\%
left:deflst@PlaceNumber{llap{normalfont
lst@numberstyle{thelstnumber}kernlst@numbersep} lst@linebgrd}\%
right:deflst@PlaceNumber{rlap{normalfont
kernlinewidth kernlst@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=4,
% linebackgroundcolor={%
% btLstHL<1>{1,3,5-6}%
% btLstHL<2>{4}%
% },
backgroundcolor=color{gray!10}
]
#include <stdio.h>

int main(void) {%
printf("Hello World!");
return 0;
}
end{lstlisting}
end{frame}
end{document}


This MWE[except backgroundcolor key] was provided by @moewe. Now when I use both keys: linebackgroundcolor and backgroundcolor, color option of backgroundcolor stops working. I tried contacting the author of the Package but not succeeded. Any suggestion for work around please.










share|improve this question





























    0















    This question is in continuation of the earlier question in which it has been modified to include background color along with linebackground color in few lines of code. MWE is given below:



    documentclass{beamer}

    usepackage{listings, pgffor}

    makeatletter
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % btIfInRange{number}{range list}{TRUE}{FALSE}
    %
    % Test if int number <number> is element of a (comma separated) list of ranges
    % (such as: {1,3-5,7,10-12,14}) and processes <TRUE> or <FALSE> respectively

    newcountbt@rangea
    newcountbt@rangeb

    newcommandbtIfInRange[2]{%
    globalletbt@inrange@secondoftwo%
    edefbt@rangelist{#2}%
    foreach range in bt@rangelist {%
    afterassignmentbt@getrangeb%
    bt@rangea=0rangerelax%
    pgfmathtruncatemacroresult{ ( #1 >= bt@rangea) && (#1 <= bt@rangeb) }%
    ifnumresult=1relax%
    breakforeach%
    globalletbt@inrange@firstoftwo%
    fi%
    }%
    bt@inrange%
    }%
    newcommandbt@getrangeb{%
    @ifnextcharrelax%
    {bt@rangeb=bt@rangea}%
    {@getrangeb}%
    }%
    def@getrangeb-#1relax{%
    ifxrelax#1relax%
    bt@rangeb=100000% maxdimen is too large for pgfmath
    else%
    bt@rangeb=#1relax%
    fi%
    }%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % btLstHL<overlay spec>{range list}
    %
    newcommand<>{btLstHL}[1]{%
    only#2{btIfInRange{value{lstnumber}}{#1}{color{blue!30}}{}}%
    }%


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    % btInputEmph<overlay spec>[listing options]{range list}{file name}
    %
    newcommand<>{btLstInputEmph}[3][empty]{%
    only#4{%
    lstset{linebackgroundcolor=btLstHL{#2}}%
    lstinputlisting{#3}%
    }% only
    }%
    makeatletter
    letold@lstKV@SwitchCaseslstKV@SwitchCases
    deflstKV@SwitchCases#1#2#3{}
    makeatother
    usepackage{lstlinebgrd}
    makeatletter
    letlstKV@SwitchCasesold@lstKV@SwitchCases
    lst@Key{numbers}{none}{%
    deflst@PlaceNumber{lst@linebgrd}%
    lstKV@SwitchCases{#1}%
    {none:\%
    left:deflst@PlaceNumber{llap{normalfont
    lst@numberstyle{thelstnumber}kernlst@numbersep} lst@linebgrd}\%
    right:deflst@PlaceNumber{rlap{normalfont
    kernlinewidth kernlst@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=4,
    % linebackgroundcolor={%
    % btLstHL<1>{1,3,5-6}%
    % btLstHL<2>{4}%
    % },
    backgroundcolor=color{gray!10}
    ]
    #include <stdio.h>

    int main(void) {%
    printf("Hello World!");
    return 0;
    }
    end{lstlisting}
    end{frame}
    end{document}


    This MWE[except backgroundcolor key] was provided by @moewe. Now when I use both keys: linebackgroundcolor and backgroundcolor, color option of backgroundcolor stops working. I tried contacting the author of the Package but not succeeded. Any suggestion for work around please.










    share|improve this question



























      0












      0








      0








      This question is in continuation of the earlier question in which it has been modified to include background color along with linebackground color in few lines of code. MWE is given below:



      documentclass{beamer}

      usepackage{listings, pgffor}

      makeatletter
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btIfInRange{number}{range list}{TRUE}{FALSE}
      %
      % Test if int number <number> is element of a (comma separated) list of ranges
      % (such as: {1,3-5,7,10-12,14}) and processes <TRUE> or <FALSE> respectively

      newcountbt@rangea
      newcountbt@rangeb

      newcommandbtIfInRange[2]{%
      globalletbt@inrange@secondoftwo%
      edefbt@rangelist{#2}%
      foreach range in bt@rangelist {%
      afterassignmentbt@getrangeb%
      bt@rangea=0rangerelax%
      pgfmathtruncatemacroresult{ ( #1 >= bt@rangea) && (#1 <= bt@rangeb) }%
      ifnumresult=1relax%
      breakforeach%
      globalletbt@inrange@firstoftwo%
      fi%
      }%
      bt@inrange%
      }%
      newcommandbt@getrangeb{%
      @ifnextcharrelax%
      {bt@rangeb=bt@rangea}%
      {@getrangeb}%
      }%
      def@getrangeb-#1relax{%
      ifxrelax#1relax%
      bt@rangeb=100000% maxdimen is too large for pgfmath
      else%
      bt@rangeb=#1relax%
      fi%
      }%

      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btLstHL<overlay spec>{range list}
      %
      newcommand<>{btLstHL}[1]{%
      only#2{btIfInRange{value{lstnumber}}{#1}{color{blue!30}}{}}%
      }%


      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btInputEmph<overlay spec>[listing options]{range list}{file name}
      %
      newcommand<>{btLstInputEmph}[3][empty]{%
      only#4{%
      lstset{linebackgroundcolor=btLstHL{#2}}%
      lstinputlisting{#3}%
      }% only
      }%
      makeatletter
      letold@lstKV@SwitchCaseslstKV@SwitchCases
      deflstKV@SwitchCases#1#2#3{}
      makeatother
      usepackage{lstlinebgrd}
      makeatletter
      letlstKV@SwitchCasesold@lstKV@SwitchCases
      lst@Key{numbers}{none}{%
      deflst@PlaceNumber{lst@linebgrd}%
      lstKV@SwitchCases{#1}%
      {none:\%
      left:deflst@PlaceNumber{llap{normalfont
      lst@numberstyle{thelstnumber}kernlst@numbersep} lst@linebgrd}\%
      right:deflst@PlaceNumber{rlap{normalfont
      kernlinewidth kernlst@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=4,
      % linebackgroundcolor={%
      % btLstHL<1>{1,3,5-6}%
      % btLstHL<2>{4}%
      % },
      backgroundcolor=color{gray!10}
      ]
      #include <stdio.h>

      int main(void) {%
      printf("Hello World!");
      return 0;
      }
      end{lstlisting}
      end{frame}
      end{document}


      This MWE[except backgroundcolor key] was provided by @moewe. Now when I use both keys: linebackgroundcolor and backgroundcolor, color option of backgroundcolor stops working. I tried contacting the author of the Package but not succeeded. Any suggestion for work around please.










      share|improve this question
















      This question is in continuation of the earlier question in which it has been modified to include background color along with linebackground color in few lines of code. MWE is given below:



      documentclass{beamer}

      usepackage{listings, pgffor}

      makeatletter
      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btIfInRange{number}{range list}{TRUE}{FALSE}
      %
      % Test if int number <number> is element of a (comma separated) list of ranges
      % (such as: {1,3-5,7,10-12,14}) and processes <TRUE> or <FALSE> respectively

      newcountbt@rangea
      newcountbt@rangeb

      newcommandbtIfInRange[2]{%
      globalletbt@inrange@secondoftwo%
      edefbt@rangelist{#2}%
      foreach range in bt@rangelist {%
      afterassignmentbt@getrangeb%
      bt@rangea=0rangerelax%
      pgfmathtruncatemacroresult{ ( #1 >= bt@rangea) && (#1 <= bt@rangeb) }%
      ifnumresult=1relax%
      breakforeach%
      globalletbt@inrange@firstoftwo%
      fi%
      }%
      bt@inrange%
      }%
      newcommandbt@getrangeb{%
      @ifnextcharrelax%
      {bt@rangeb=bt@rangea}%
      {@getrangeb}%
      }%
      def@getrangeb-#1relax{%
      ifxrelax#1relax%
      bt@rangeb=100000% maxdimen is too large for pgfmath
      else%
      bt@rangeb=#1relax%
      fi%
      }%

      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btLstHL<overlay spec>{range list}
      %
      newcommand<>{btLstHL}[1]{%
      only#2{btIfInRange{value{lstnumber}}{#1}{color{blue!30}}{}}%
      }%


      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      % btInputEmph<overlay spec>[listing options]{range list}{file name}
      %
      newcommand<>{btLstInputEmph}[3][empty]{%
      only#4{%
      lstset{linebackgroundcolor=btLstHL{#2}}%
      lstinputlisting{#3}%
      }% only
      }%
      makeatletter
      letold@lstKV@SwitchCaseslstKV@SwitchCases
      deflstKV@SwitchCases#1#2#3{}
      makeatother
      usepackage{lstlinebgrd}
      makeatletter
      letlstKV@SwitchCasesold@lstKV@SwitchCases
      lst@Key{numbers}{none}{%
      deflst@PlaceNumber{lst@linebgrd}%
      lstKV@SwitchCases{#1}%
      {none:\%
      left:deflst@PlaceNumber{llap{normalfont
      lst@numberstyle{thelstnumber}kernlst@numbersep} lst@linebgrd}\%
      right:deflst@PlaceNumber{rlap{normalfont
      kernlinewidth kernlst@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=4,
      % linebackgroundcolor={%
      % btLstHL<1>{1,3,5-6}%
      % btLstHL<2>{4}%
      % },
      backgroundcolor=color{gray!10}
      ]
      #include <stdio.h>

      int main(void) {%
      printf("Hello World!");
      return 0;
      }
      end{lstlisting}
      end{frame}
      end{document}


      This MWE[except backgroundcolor key] was provided by @moewe. Now when I use both keys: linebackgroundcolor and backgroundcolor, color option of backgroundcolor stops working. I tried contacting the author of the Package but not succeeded. Any suggestion for work around please.







      color listings backgrounds






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 26 at 3:02









      Henri Menke

      76k8167281




      76k8167281










      asked Feb 24 at 16:02









      KhaabaKhaaba

      9151025




      9151025






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476466%2frecent-issues-with-lstlinebgrd-package-with-listings-after-the-latters-update%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f476466%2frecent-issues-with-lstlinebgrd-package-with-listings-after-the-latters-update%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents