Summing the values of a sequence using expl3expl3 outputting sequence of plistsexpl3 par and sequencesHow to embed a command in an environment using Expl3?Automatic Labels with automatically generated keysDetermining the length of an expl3 sequenceMore efficient implementation using expl3Problem using a sequence in expl3Using a sequence for the x values in a functiontableNested splitting of a sequence using expl3expl3 property list values as `clist` vs token lists

Why was the battle set up *outside* Winterfell?

What are the spoon bit of a spoon and fork bit of a fork called?

Reconstruct a matrix from its traces

Which industry am I working in? Software development or financial services?

Can't remove one character of space in my environment

Answer "Justification for travel support" in conference registration form

What do you call the "hold on" music that plays when you wait on the phone?

If 1. e4 c6 is considered as a sound defense for black, why is 1. c3 so rare?

Is this homebrew life-stealing melee cantrip unbalanced?

Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?

Can I get a paladin's steed by True Polymorphing into a monster that can cast Find Steed?

Alias to source .bashrc after it's been edited?

Catholic vs Protestant Support for Nazism in Germany

If Earth is tilted, why is Polaris always above the same spot?

In a vacuum triode, what prevents the grid from acting as another anode?

Do I have to make someone coauthor if he/she solves a problem in StackExchange, asked by myself, which is later used in my paper?

Returning the outputs of a nested structure

Python password manager

Why is `abs()` implemented differently?

Pressure inside an infinite ocean?

Enumerate Derangements

Why wasn't the Night King naked in S08E03?

Virus Detected - Please execute anti-virus code

How could a planet have most of its water in the atmosphere?



Summing the values of a sequence using expl3


expl3 outputting sequence of plistsexpl3 par and sequencesHow to embed a command in an environment using Expl3?Automatic Labels with automatically generated keysDetermining the length of an expl3 sequenceMore efficient implementation using expl3Problem using a sequence in expl3Using a sequence for the x values in a functiontableNested splitting of a sequence using expl3expl3 property list values as `clist` vs token lists













2















In the code below, what should the definition of sumcounters be to make it sum the current values of the counters thm and lemma?



documentclassbook
usepackageamsthm
usepackagexparse
newtheoremthmTheorem[chapter]
newtheoremlemmaLemma[chapter]
ExplSyntaxOn
seq_new:N g_my_counters
seq_gput_right:Nn g_my_counters thm
seq_gput_right:Nn g_my_counters lemma
% NewDocumentCommandsumcounters< ? >
ExplSyntaxOff
begindocument
chapterSome chapter
sumcounters % should print 0

beginthm
A theorem.
endthm
sumcounters % should print 1

beginlemma
A lemma.
endlemma
sumcounters % should print 2
enddocument









share|improve this question


























    2















    In the code below, what should the definition of sumcounters be to make it sum the current values of the counters thm and lemma?



    documentclassbook
    usepackageamsthm
    usepackagexparse
    newtheoremthmTheorem[chapter]
    newtheoremlemmaLemma[chapter]
    ExplSyntaxOn
    seq_new:N g_my_counters
    seq_gput_right:Nn g_my_counters thm
    seq_gput_right:Nn g_my_counters lemma
    % NewDocumentCommandsumcounters< ? >
    ExplSyntaxOff
    begindocument
    chapterSome chapter
    sumcounters % should print 0

    beginthm
    A theorem.
    endthm
    sumcounters % should print 1

    beginlemma
    A lemma.
    endlemma
    sumcounters % should print 2
    enddocument









    share|improve this question
























      2












      2








      2








      In the code below, what should the definition of sumcounters be to make it sum the current values of the counters thm and lemma?



      documentclassbook
      usepackageamsthm
      usepackagexparse
      newtheoremthmTheorem[chapter]
      newtheoremlemmaLemma[chapter]
      ExplSyntaxOn
      seq_new:N g_my_counters
      seq_gput_right:Nn g_my_counters thm
      seq_gput_right:Nn g_my_counters lemma
      % NewDocumentCommandsumcounters< ? >
      ExplSyntaxOff
      begindocument
      chapterSome chapter
      sumcounters % should print 0

      beginthm
      A theorem.
      endthm
      sumcounters % should print 1

      beginlemma
      A lemma.
      endlemma
      sumcounters % should print 2
      enddocument









      share|improve this question














      In the code below, what should the definition of sumcounters be to make it sum the current values of the counters thm and lemma?



      documentclassbook
      usepackageamsthm
      usepackagexparse
      newtheoremthmTheorem[chapter]
      newtheoremlemmaLemma[chapter]
      ExplSyntaxOn
      seq_new:N g_my_counters
      seq_gput_right:Nn g_my_counters thm
      seq_gput_right:Nn g_my_counters lemma
      % NewDocumentCommandsumcounters< ? >
      ExplSyntaxOff
      begindocument
      chapterSome chapter
      sumcounters % should print 0

      beginthm
      A theorem.
      endthm
      sumcounters % should print 1

      beginlemma
      A lemma.
      endlemma
      sumcounters % should print 2
      enddocument






      expl3 xparse






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      noibenoibe

      675113




      675113




















          2 Answers
          2






          active

          oldest

          votes


















          2














          You could probably do this with a temporary counter, such as l_tmpa_int, but the code below defines a new counter l_counter_sum_int and then the sumcounters macro uses seq_map_inline:Nn to add the current values of the counters in g_my_counters, after which it prints the result. The output is the expected:



          enter image description here



          Here is the full code:



          documentclassbook
          usepackageamsthm
          usepackagexparse
          newtheoremthmTheorem[chapter]
          newtheoremlemmaLemma[chapter]
          ExplSyntaxOn
          seq_new:N g_my_counters
          seq_gput_right:Nn g_my_counters thm
          seq_gput_right:Nn g_my_counters lemma
          int_new:N l_counter_sum_int% local counter for adding counter values
          NewDocumentCommandsumcounters
          int_zero:N l_counter_sum_int% set l_counter_sum_int to 0
          seq_map_inline:Nn g_my_counters % add counters in g_my_counters
          int_add:Nn l_counter_sum_int value##1

          int_use:N l_counter_sum_int% print the result

          ExplSyntaxOff
          begindocument
          chapterSome chapter
          sumcounters % should print 0

          beginthm
          A theorem.
          endthm
          sumcounters % should print 1

          beginlemma
          A lemma.
          endlemma
          sumcounters % should print 2
          enddocument





          share|improve this answer























          • Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

            – noibe
            4 hours ago











          • @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

            – Andrew
            4 hours ago












          • If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

            – noibe
            4 hours ago











          • @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

            – Andrew
            2 hours ago


















          3














          Instead of performing an assignment, you can also calculate the sum fully-expandably. This has the advantage that you can use it in conditionals, such as



          ifnumsumcounters=0 ... fi


          I also want to remind you of the expl3 convention to use Hungarian notation for variables, i.e. a variable should carry in its name the data type it holds, usually as a suffix.



          documentclassbook
          usepackageamsthm
          usepackagexparse
          newtheoremthmTheorem[chapter]
          newtheoremlemmaLemma[chapter]

          ExplSyntaxOn

          seq_new:N g_my_counters_seq
          seq_gput_right:Nn g_my_counters_seq thm
          seq_gput_right:Nn g_my_counters_seq lemma

          cs_new:Npn my_plus_value:n #1

          + (value#1)


          NewExpandableDocumentCommand sumcounters

          int_eval:n

          ( 0 seq_map_function:NN g_my_counters_seq my_plus_value:n )



          ExplSyntaxOff

          begindocument
          chapterSome chapter
          sumcounters % should print 0

          beginthm
          A theorem.
          endthm
          sumcounters % should print 1

          beginlemma
          A lemma.
          endlemma
          sumcounters % should print 2
          enddocument





          share|improve this answer























            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%2f488517%2fsumming-the-values-of-a-sequence-using-expl3%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You could probably do this with a temporary counter, such as l_tmpa_int, but the code below defines a new counter l_counter_sum_int and then the sumcounters macro uses seq_map_inline:Nn to add the current values of the counters in g_my_counters, after which it prints the result. The output is the expected:



            enter image description here



            Here is the full code:



            documentclassbook
            usepackageamsthm
            usepackagexparse
            newtheoremthmTheorem[chapter]
            newtheoremlemmaLemma[chapter]
            ExplSyntaxOn
            seq_new:N g_my_counters
            seq_gput_right:Nn g_my_counters thm
            seq_gput_right:Nn g_my_counters lemma
            int_new:N l_counter_sum_int% local counter for adding counter values
            NewDocumentCommandsumcounters
            int_zero:N l_counter_sum_int% set l_counter_sum_int to 0
            seq_map_inline:Nn g_my_counters % add counters in g_my_counters
            int_add:Nn l_counter_sum_int value##1

            int_use:N l_counter_sum_int% print the result

            ExplSyntaxOff
            begindocument
            chapterSome chapter
            sumcounters % should print 0

            beginthm
            A theorem.
            endthm
            sumcounters % should print 1

            beginlemma
            A lemma.
            endlemma
            sumcounters % should print 2
            enddocument





            share|improve this answer























            • Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

              – noibe
              4 hours ago











            • @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

              – Andrew
              4 hours ago












            • If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

              – noibe
              4 hours ago











            • @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

              – Andrew
              2 hours ago















            2














            You could probably do this with a temporary counter, such as l_tmpa_int, but the code below defines a new counter l_counter_sum_int and then the sumcounters macro uses seq_map_inline:Nn to add the current values of the counters in g_my_counters, after which it prints the result. The output is the expected:



            enter image description here



            Here is the full code:



            documentclassbook
            usepackageamsthm
            usepackagexparse
            newtheoremthmTheorem[chapter]
            newtheoremlemmaLemma[chapter]
            ExplSyntaxOn
            seq_new:N g_my_counters
            seq_gput_right:Nn g_my_counters thm
            seq_gput_right:Nn g_my_counters lemma
            int_new:N l_counter_sum_int% local counter for adding counter values
            NewDocumentCommandsumcounters
            int_zero:N l_counter_sum_int% set l_counter_sum_int to 0
            seq_map_inline:Nn g_my_counters % add counters in g_my_counters
            int_add:Nn l_counter_sum_int value##1

            int_use:N l_counter_sum_int% print the result

            ExplSyntaxOff
            begindocument
            chapterSome chapter
            sumcounters % should print 0

            beginthm
            A theorem.
            endthm
            sumcounters % should print 1

            beginlemma
            A lemma.
            endlemma
            sumcounters % should print 2
            enddocument





            share|improve this answer























            • Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

              – noibe
              4 hours ago











            • @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

              – Andrew
              4 hours ago












            • If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

              – noibe
              4 hours ago











            • @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

              – Andrew
              2 hours ago













            2












            2








            2







            You could probably do this with a temporary counter, such as l_tmpa_int, but the code below defines a new counter l_counter_sum_int and then the sumcounters macro uses seq_map_inline:Nn to add the current values of the counters in g_my_counters, after which it prints the result. The output is the expected:



            enter image description here



            Here is the full code:



            documentclassbook
            usepackageamsthm
            usepackagexparse
            newtheoremthmTheorem[chapter]
            newtheoremlemmaLemma[chapter]
            ExplSyntaxOn
            seq_new:N g_my_counters
            seq_gput_right:Nn g_my_counters thm
            seq_gput_right:Nn g_my_counters lemma
            int_new:N l_counter_sum_int% local counter for adding counter values
            NewDocumentCommandsumcounters
            int_zero:N l_counter_sum_int% set l_counter_sum_int to 0
            seq_map_inline:Nn g_my_counters % add counters in g_my_counters
            int_add:Nn l_counter_sum_int value##1

            int_use:N l_counter_sum_int% print the result

            ExplSyntaxOff
            begindocument
            chapterSome chapter
            sumcounters % should print 0

            beginthm
            A theorem.
            endthm
            sumcounters % should print 1

            beginlemma
            A lemma.
            endlemma
            sumcounters % should print 2
            enddocument





            share|improve this answer













            You could probably do this with a temporary counter, such as l_tmpa_int, but the code below defines a new counter l_counter_sum_int and then the sumcounters macro uses seq_map_inline:Nn to add the current values of the counters in g_my_counters, after which it prints the result. The output is the expected:



            enter image description here



            Here is the full code:



            documentclassbook
            usepackageamsthm
            usepackagexparse
            newtheoremthmTheorem[chapter]
            newtheoremlemmaLemma[chapter]
            ExplSyntaxOn
            seq_new:N g_my_counters
            seq_gput_right:Nn g_my_counters thm
            seq_gput_right:Nn g_my_counters lemma
            int_new:N l_counter_sum_int% local counter for adding counter values
            NewDocumentCommandsumcounters
            int_zero:N l_counter_sum_int% set l_counter_sum_int to 0
            seq_map_inline:Nn g_my_counters % add counters in g_my_counters
            int_add:Nn l_counter_sum_int value##1

            int_use:N l_counter_sum_int% print the result

            ExplSyntaxOff
            begindocument
            chapterSome chapter
            sumcounters % should print 0

            beginthm
            A theorem.
            endthm
            sumcounters % should print 1

            beginlemma
            A lemma.
            endlemma
            sumcounters % should print 2
            enddocument






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 4 hours ago









            AndrewAndrew

            31.8k34583




            31.8k34583












            • Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

              – noibe
              4 hours ago











            • @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

              – Andrew
              4 hours ago












            • If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

              – noibe
              4 hours ago











            • @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

              – Andrew
              2 hours ago

















            • Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

              – noibe
              4 hours ago











            • @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

              – Andrew
              4 hours ago












            • If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

              – noibe
              4 hours ago











            • @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

              – Andrew
              2 hours ago
















            Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

            – noibe
            4 hours ago





            Does it make a difference if I put int_new:N l_counter_sum_int inside the definition of sumcounters?

            – noibe
            4 hours ago













            @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

            – Andrew
            4 hours ago






            @noibe Yes, it makes a difference: the code above will give an error because the second and subsequent calls of sumcounters will try to define a define a counter that already exists. Alternatively, as I suggested, you can instead use l_tmpa_int in sumcounters, in which case you can drop the int_new:N command completely. (I just checked and this works.)

            – Andrew
            4 hours ago














            If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

            – noibe
            4 hours ago





            If instead of directly using sumcounters I type ifnumsumcounters=0 yes else no fi I get some unexpected results, while I'de expect a yes and two no's. What am I doing wrong?

            – noibe
            4 hours ago













            @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

            – Andrew
            2 hours ago





            @noibe As Henri says, this is an expansion issue. I didn't know you would want to use sumcounters this way. I don't see an easy way to make my code work, so Henri's expandable solution is the way to go.

            – Andrew
            2 hours ago











            3














            Instead of performing an assignment, you can also calculate the sum fully-expandably. This has the advantage that you can use it in conditionals, such as



            ifnumsumcounters=0 ... fi


            I also want to remind you of the expl3 convention to use Hungarian notation for variables, i.e. a variable should carry in its name the data type it holds, usually as a suffix.



            documentclassbook
            usepackageamsthm
            usepackagexparse
            newtheoremthmTheorem[chapter]
            newtheoremlemmaLemma[chapter]

            ExplSyntaxOn

            seq_new:N g_my_counters_seq
            seq_gput_right:Nn g_my_counters_seq thm
            seq_gput_right:Nn g_my_counters_seq lemma

            cs_new:Npn my_plus_value:n #1

            + (value#1)


            NewExpandableDocumentCommand sumcounters

            int_eval:n

            ( 0 seq_map_function:NN g_my_counters_seq my_plus_value:n )



            ExplSyntaxOff

            begindocument
            chapterSome chapter
            sumcounters % should print 0

            beginthm
            A theorem.
            endthm
            sumcounters % should print 1

            beginlemma
            A lemma.
            endlemma
            sumcounters % should print 2
            enddocument





            share|improve this answer



























              3














              Instead of performing an assignment, you can also calculate the sum fully-expandably. This has the advantage that you can use it in conditionals, such as



              ifnumsumcounters=0 ... fi


              I also want to remind you of the expl3 convention to use Hungarian notation for variables, i.e. a variable should carry in its name the data type it holds, usually as a suffix.



              documentclassbook
              usepackageamsthm
              usepackagexparse
              newtheoremthmTheorem[chapter]
              newtheoremlemmaLemma[chapter]

              ExplSyntaxOn

              seq_new:N g_my_counters_seq
              seq_gput_right:Nn g_my_counters_seq thm
              seq_gput_right:Nn g_my_counters_seq lemma

              cs_new:Npn my_plus_value:n #1

              + (value#1)


              NewExpandableDocumentCommand sumcounters

              int_eval:n

              ( 0 seq_map_function:NN g_my_counters_seq my_plus_value:n )



              ExplSyntaxOff

              begindocument
              chapterSome chapter
              sumcounters % should print 0

              beginthm
              A theorem.
              endthm
              sumcounters % should print 1

              beginlemma
              A lemma.
              endlemma
              sumcounters % should print 2
              enddocument





              share|improve this answer

























                3












                3








                3







                Instead of performing an assignment, you can also calculate the sum fully-expandably. This has the advantage that you can use it in conditionals, such as



                ifnumsumcounters=0 ... fi


                I also want to remind you of the expl3 convention to use Hungarian notation for variables, i.e. a variable should carry in its name the data type it holds, usually as a suffix.



                documentclassbook
                usepackageamsthm
                usepackagexparse
                newtheoremthmTheorem[chapter]
                newtheoremlemmaLemma[chapter]

                ExplSyntaxOn

                seq_new:N g_my_counters_seq
                seq_gput_right:Nn g_my_counters_seq thm
                seq_gput_right:Nn g_my_counters_seq lemma

                cs_new:Npn my_plus_value:n #1

                + (value#1)


                NewExpandableDocumentCommand sumcounters

                int_eval:n

                ( 0 seq_map_function:NN g_my_counters_seq my_plus_value:n )



                ExplSyntaxOff

                begindocument
                chapterSome chapter
                sumcounters % should print 0

                beginthm
                A theorem.
                endthm
                sumcounters % should print 1

                beginlemma
                A lemma.
                endlemma
                sumcounters % should print 2
                enddocument





                share|improve this answer













                Instead of performing an assignment, you can also calculate the sum fully-expandably. This has the advantage that you can use it in conditionals, such as



                ifnumsumcounters=0 ... fi


                I also want to remind you of the expl3 convention to use Hungarian notation for variables, i.e. a variable should carry in its name the data type it holds, usually as a suffix.



                documentclassbook
                usepackageamsthm
                usepackagexparse
                newtheoremthmTheorem[chapter]
                newtheoremlemmaLemma[chapter]

                ExplSyntaxOn

                seq_new:N g_my_counters_seq
                seq_gput_right:Nn g_my_counters_seq thm
                seq_gput_right:Nn g_my_counters_seq lemma

                cs_new:Npn my_plus_value:n #1

                + (value#1)


                NewExpandableDocumentCommand sumcounters

                int_eval:n

                ( 0 seq_map_function:NN g_my_counters_seq my_plus_value:n )



                ExplSyntaxOff

                begindocument
                chapterSome chapter
                sumcounters % should print 0

                beginthm
                A theorem.
                endthm
                sumcounters % should print 1

                beginlemma
                A lemma.
                endlemma
                sumcounters % should print 2
                enddocument






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 3 hours ago









                Henri MenkeHenri Menke

                78.3k8171285




                78.3k8171285



























                    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%2f488517%2fsumming-the-values-of-a-sequence-using-expl3%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

                    Log på Navigationsmenu

                    Wonderful Copenhagen (sang) Eksterne henvisninger | NavigationsmenurSide på frankloesser.comWonderful Copenhagen

                    Detroit Tigers Spis treści Historia | Skład zespołu | Sukcesy | Członkowie Baseball Hall of Fame | Zastrzeżone numery | Przypisy | Menu nawigacyjneEncyclopedia of Detroit - Detroit TigersTigers Stadium, Detroit, MITigers Timeline 1900sDetroit Tigers Team History & EncyclopediaTigers Timeline 1910s1935 World Series1945 World Series1945 World Series1984 World SeriesComerica Park, Detroit, MI2006 World Series2012 World SeriesDetroit Tigers 40-Man RosterDetroit Tigers Coaching StaffTigers Hall of FamersTigers Retired Numberse