Problem loading optidef package and addtocontents

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I am using Miktex 2.9 with Texstudio 2.12.6. My document is in KOMA-class. As I was trying to load the optidef package, I got an error which seems related to addcontentslinetoc.
I assumed some outdated packages to be the cause, so I have updated all packages using Miktex Updater. The problem remains.



Here is a MWE:



documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

%%%%%%%%%%%%%%%%% BEGIN PACKAGES
%%% Page header
usepackage[automark,headsepline=off]scrlayer-scrpage

%%% Mathematic equations
%usepackageoptidef

%%% links in pdf
usepackagehyperref
usepackage[all]hypcap
usepackage[numbered]bookmark

%%%%%%%%%%%%%%%%% END PACKAGES

begindocument

%%% ToC
pagenumberingroman
phantomsection
pdfbookmarkInhaltsverzeichnistoc
setcountertocdepth4
tableofcontents

%%%% from here on: add elements to ToC
addtocontentstocsetcountertocdepth0

%%%% chapters
addtocontentstocsetcountertocdepth4

chapterTest
test

%%%% Optidef Example
%beginmini[2]
% wf(w)+ R(w+6x)
% labeleq:Example1
%
% addConstraintg(w)=0
% addConstraintn(w)= 6
% addConstraintL(w)+r(x)=Kw+p
% addConstrainth(x)=0.
%endmini

enddocument


Without optidef package, the document compiles flawlessly. As soon as I load the package optidef, I will get the following error message for all corresponding lines of code:




Undefined control sequence.
addtocontentstocsetcountertocdepth0




Does anyone have a solution? Thank you very much in advance.



Best regards,
Dan.










share|improve this question

























    up vote
    1
    down vote

    favorite












    I am using Miktex 2.9 with Texstudio 2.12.6. My document is in KOMA-class. As I was trying to load the optidef package, I got an error which seems related to addcontentslinetoc.
    I assumed some outdated packages to be the cause, so I have updated all packages using Miktex Updater. The problem remains.



    Here is a MWE:



    documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

    %%%%%%%%%%%%%%%%% BEGIN PACKAGES
    %%% Page header
    usepackage[automark,headsepline=off]scrlayer-scrpage

    %%% Mathematic equations
    %usepackageoptidef

    %%% links in pdf
    usepackagehyperref
    usepackage[all]hypcap
    usepackage[numbered]bookmark

    %%%%%%%%%%%%%%%%% END PACKAGES

    begindocument

    %%% ToC
    pagenumberingroman
    phantomsection
    pdfbookmarkInhaltsverzeichnistoc
    setcountertocdepth4
    tableofcontents

    %%%% from here on: add elements to ToC
    addtocontentstocsetcountertocdepth0

    %%%% chapters
    addtocontentstocsetcountertocdepth4

    chapterTest
    test

    %%%% Optidef Example
    %beginmini[2]
    % wf(w)+ R(w+6x)
    % labeleq:Example1
    %
    % addConstraintg(w)=0
    % addConstraintn(w)= 6
    % addConstraintL(w)+r(x)=Kw+p
    % addConstrainth(x)=0.
    %endmini

    enddocument


    Without optidef package, the document compiles flawlessly. As soon as I load the package optidef, I will get the following error message for all corresponding lines of code:




    Undefined control sequence.
    addtocontentstocsetcountertocdepth0




    Does anyone have a solution? Thank you very much in advance.



    Best regards,
    Dan.










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am using Miktex 2.9 with Texstudio 2.12.6. My document is in KOMA-class. As I was trying to load the optidef package, I got an error which seems related to addcontentslinetoc.
      I assumed some outdated packages to be the cause, so I have updated all packages using Miktex Updater. The problem remains.



      Here is a MWE:



      documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

      %%%%%%%%%%%%%%%%% BEGIN PACKAGES
      %%% Page header
      usepackage[automark,headsepline=off]scrlayer-scrpage

      %%% Mathematic equations
      %usepackageoptidef

      %%% links in pdf
      usepackagehyperref
      usepackage[all]hypcap
      usepackage[numbered]bookmark

      %%%%%%%%%%%%%%%%% END PACKAGES

      begindocument

      %%% ToC
      pagenumberingroman
      phantomsection
      pdfbookmarkInhaltsverzeichnistoc
      setcountertocdepth4
      tableofcontents

      %%%% from here on: add elements to ToC
      addtocontentstocsetcountertocdepth0

      %%%% chapters
      addtocontentstocsetcountertocdepth4

      chapterTest
      test

      %%%% Optidef Example
      %beginmini[2]
      % wf(w)+ R(w+6x)
      % labeleq:Example1
      %
      % addConstraintg(w)=0
      % addConstraintn(w)= 6
      % addConstraintL(w)+r(x)=Kw+p
      % addConstrainth(x)=0.
      %endmini

      enddocument


      Without optidef package, the document compiles flawlessly. As soon as I load the package optidef, I will get the following error message for all corresponding lines of code:




      Undefined control sequence.
      addtocontentstocsetcountertocdepth0




      Does anyone have a solution? Thank you very much in advance.



      Best regards,
      Dan.










      share|improve this question













      I am using Miktex 2.9 with Texstudio 2.12.6. My document is in KOMA-class. As I was trying to load the optidef package, I got an error which seems related to addcontentslinetoc.
      I assumed some outdated packages to be the cause, so I have updated all packages using Miktex Updater. The problem remains.



      Here is a MWE:



      documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

      %%%%%%%%%%%%%%%%% BEGIN PACKAGES
      %%% Page header
      usepackage[automark,headsepline=off]scrlayer-scrpage

      %%% Mathematic equations
      %usepackageoptidef

      %%% links in pdf
      usepackagehyperref
      usepackage[all]hypcap
      usepackage[numbered]bookmark

      %%%%%%%%%%%%%%%%% END PACKAGES

      begindocument

      %%% ToC
      pagenumberingroman
      phantomsection
      pdfbookmarkInhaltsverzeichnistoc
      setcountertocdepth4
      tableofcontents

      %%%% from here on: add elements to ToC
      addtocontentstocsetcountertocdepth0

      %%%% chapters
      addtocontentstocsetcountertocdepth4

      chapterTest
      test

      %%%% Optidef Example
      %beginmini[2]
      % wf(w)+ R(w+6x)
      % labeleq:Example1
      %
      % addConstraintg(w)=0
      % addConstraintn(w)= 6
      % addConstraintL(w)+r(x)=Kw+p
      % addConstrainth(x)=0.
      %endmini

      enddocument


      Without optidef package, the document compiles flawlessly. As soon as I load the package optidef, I will get the following error message for all corresponding lines of code:




      Undefined control sequence.
      addtocontentstocsetcountertocdepth0




      Does anyone have a solution? Thank you very much in advance.



      Best regards,
      Dan.







      optidef






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      dan

      506




      506




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          Add some protect:



          documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

          %%%%%%%%%%%%%%%%% BEGIN PACKAGES
          %%% Page header
          usepackage[automark,headsepline=off]scrlayer-scrpage

          %%% Mathematic equations
          usepackageoptidef

          %%% links in pdf
          usepackagehyperref
          usepackage[all]hypcap
          usepackage[numbered]bookmark

          %%%%%%%%%%%%%%%%% END PACKAGES

          begindocument

          %%% ToC
          pagenumberingroman
          phantomsection
          pdfbookmarkInhaltsverzeichnistoc
          setcountertocdepth4
          tableofcontents

          %%%% from here on: add elements to ToC
          addtocontentstocprotectsetcountertocdepth0

          %%%% chapters
          addtocontentstocprotectsetcountertocdepth4

          chapterTest
          test

          %%%% Optidef Example
          beginmini[2]
          wf(w)+ R(w+6x)
          labeleq:Example1

          addConstraintg(w)=0
          addConstraintn(w)= 6
          addConstraintL(w)+r(x)=Kw+p
          addConstrainth(x)=0.
          endmini

          enddocument



          Explanation: optidef requires package calc and the latter modifies setcounter in a way which makes the protect here needed.






          share|improve this answer




















          • but these lines do not make much sense anyhow especially one after the other
            – jfbu
            2 hours ago










          • Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
            – dan
            1 hour ago










          • @dan Actually protect should also be used without loading optidef.
            – egreg
            6 mins ago










          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          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%2f454224%2fproblem-loading-optidef-package-and-addtocontents%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          Add some protect:



          documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

          %%%%%%%%%%%%%%%%% BEGIN PACKAGES
          %%% Page header
          usepackage[automark,headsepline=off]scrlayer-scrpage

          %%% Mathematic equations
          usepackageoptidef

          %%% links in pdf
          usepackagehyperref
          usepackage[all]hypcap
          usepackage[numbered]bookmark

          %%%%%%%%%%%%%%%%% END PACKAGES

          begindocument

          %%% ToC
          pagenumberingroman
          phantomsection
          pdfbookmarkInhaltsverzeichnistoc
          setcountertocdepth4
          tableofcontents

          %%%% from here on: add elements to ToC
          addtocontentstocprotectsetcountertocdepth0

          %%%% chapters
          addtocontentstocprotectsetcountertocdepth4

          chapterTest
          test

          %%%% Optidef Example
          beginmini[2]
          wf(w)+ R(w+6x)
          labeleq:Example1

          addConstraintg(w)=0
          addConstraintn(w)= 6
          addConstraintL(w)+r(x)=Kw+p
          addConstrainth(x)=0.
          endmini

          enddocument



          Explanation: optidef requires package calc and the latter modifies setcounter in a way which makes the protect here needed.






          share|improve this answer




















          • but these lines do not make much sense anyhow especially one after the other
            – jfbu
            2 hours ago










          • Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
            – dan
            1 hour ago










          • @dan Actually protect should also be used without loading optidef.
            – egreg
            6 mins ago














          up vote
          3
          down vote



          accepted










          Add some protect:



          documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

          %%%%%%%%%%%%%%%%% BEGIN PACKAGES
          %%% Page header
          usepackage[automark,headsepline=off]scrlayer-scrpage

          %%% Mathematic equations
          usepackageoptidef

          %%% links in pdf
          usepackagehyperref
          usepackage[all]hypcap
          usepackage[numbered]bookmark

          %%%%%%%%%%%%%%%%% END PACKAGES

          begindocument

          %%% ToC
          pagenumberingroman
          phantomsection
          pdfbookmarkInhaltsverzeichnistoc
          setcountertocdepth4
          tableofcontents

          %%%% from here on: add elements to ToC
          addtocontentstocprotectsetcountertocdepth0

          %%%% chapters
          addtocontentstocprotectsetcountertocdepth4

          chapterTest
          test

          %%%% Optidef Example
          beginmini[2]
          wf(w)+ R(w+6x)
          labeleq:Example1

          addConstraintg(w)=0
          addConstraintn(w)= 6
          addConstraintL(w)+r(x)=Kw+p
          addConstrainth(x)=0.
          endmini

          enddocument



          Explanation: optidef requires package calc and the latter modifies setcounter in a way which makes the protect here needed.






          share|improve this answer




















          • but these lines do not make much sense anyhow especially one after the other
            – jfbu
            2 hours ago










          • Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
            – dan
            1 hour ago










          • @dan Actually protect should also be used without loading optidef.
            – egreg
            6 mins ago












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          Add some protect:



          documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

          %%%%%%%%%%%%%%%%% BEGIN PACKAGES
          %%% Page header
          usepackage[automark,headsepline=off]scrlayer-scrpage

          %%% Mathematic equations
          usepackageoptidef

          %%% links in pdf
          usepackagehyperref
          usepackage[all]hypcap
          usepackage[numbered]bookmark

          %%%%%%%%%%%%%%%%% END PACKAGES

          begindocument

          %%% ToC
          pagenumberingroman
          phantomsection
          pdfbookmarkInhaltsverzeichnistoc
          setcountertocdepth4
          tableofcontents

          %%%% from here on: add elements to ToC
          addtocontentstocprotectsetcountertocdepth0

          %%%% chapters
          addtocontentstocprotectsetcountertocdepth4

          chapterTest
          test

          %%%% Optidef Example
          beginmini[2]
          wf(w)+ R(w+6x)
          labeleq:Example1

          addConstraintg(w)=0
          addConstraintn(w)= 6
          addConstraintL(w)+r(x)=Kw+p
          addConstrainth(x)=0.
          endmini

          enddocument



          Explanation: optidef requires package calc and the latter modifies setcounter in a way which makes the protect here needed.






          share|improve this answer












          Add some protect:



          documentclass[12pt, twoside, openright, numbers=noenddot]scrreprt 

          %%%%%%%%%%%%%%%%% BEGIN PACKAGES
          %%% Page header
          usepackage[automark,headsepline=off]scrlayer-scrpage

          %%% Mathematic equations
          usepackageoptidef

          %%% links in pdf
          usepackagehyperref
          usepackage[all]hypcap
          usepackage[numbered]bookmark

          %%%%%%%%%%%%%%%%% END PACKAGES

          begindocument

          %%% ToC
          pagenumberingroman
          phantomsection
          pdfbookmarkInhaltsverzeichnistoc
          setcountertocdepth4
          tableofcontents

          %%%% from here on: add elements to ToC
          addtocontentstocprotectsetcountertocdepth0

          %%%% chapters
          addtocontentstocprotectsetcountertocdepth4

          chapterTest
          test

          %%%% Optidef Example
          beginmini[2]
          wf(w)+ R(w+6x)
          labeleq:Example1

          addConstraintg(w)=0
          addConstraintn(w)= 6
          addConstraintL(w)+r(x)=Kw+p
          addConstrainth(x)=0.
          endmini

          enddocument



          Explanation: optidef requires package calc and the latter modifies setcounter in a way which makes the protect here needed.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 hours ago









          jfbu

          42.7k64139




          42.7k64139











          • but these lines do not make much sense anyhow especially one after the other
            – jfbu
            2 hours ago










          • Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
            – dan
            1 hour ago










          • @dan Actually protect should also be used without loading optidef.
            – egreg
            6 mins ago
















          • but these lines do not make much sense anyhow especially one after the other
            – jfbu
            2 hours ago










          • Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
            – dan
            1 hour ago










          • @dan Actually protect should also be used without loading optidef.
            – egreg
            6 mins ago















          but these lines do not make much sense anyhow especially one after the other
          – jfbu
          2 hours ago




          but these lines do not make much sense anyhow especially one after the other
          – jfbu
          2 hours ago












          Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
          – dan
          1 hour ago




          Thanks for your solution. Indeed, these lines do not make any sense in the MWE. In my actual document, I am loading prefix chapters in between these lines, which does give them a real purpose :)
          – dan
          1 hour ago












          @dan Actually protect should also be used without loading optidef.
          – egreg
          6 mins ago




          @dan Actually protect should also be used without loading optidef.
          – egreg
          6 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f454224%2fproblem-loading-optidef-package-and-addtocontents%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery