Define a new align environment with custom numeration











up vote
2
down vote

favorite












I am writting a report and I have multiple systems of equations. I want to avoid have too big numbers (Equation 4.200 for example) and I dont want to link the numbering to the chapter or the section.



I want a personalized align enviroment that enummerates the equations as:



(A1)



(A2)



(A3)



The first time I use it and



(B1)



(B2)



(B3)



The second time I use and so on.



The normal numeration of the usual align enviroment or equation enviroment should not be afffected.



I have been trying for some hours but none of the answers seems to work :(



Thanks in advance!!










share|improve this question







New contributor




Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    2
    down vote

    favorite












    I am writting a report and I have multiple systems of equations. I want to avoid have too big numbers (Equation 4.200 for example) and I dont want to link the numbering to the chapter or the section.



    I want a personalized align enviroment that enummerates the equations as:



    (A1)



    (A2)



    (A3)



    The first time I use it and



    (B1)



    (B2)



    (B3)



    The second time I use and so on.



    The normal numeration of the usual align enviroment or equation enviroment should not be afffected.



    I have been trying for some hours but none of the answers seems to work :(



    Thanks in advance!!










    share|improve this question







    New contributor




    Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I am writting a report and I have multiple systems of equations. I want to avoid have too big numbers (Equation 4.200 for example) and I dont want to link the numbering to the chapter or the section.



      I want a personalized align enviroment that enummerates the equations as:



      (A1)



      (A2)



      (A3)



      The first time I use it and



      (B1)



      (B2)



      (B3)



      The second time I use and so on.



      The normal numeration of the usual align enviroment or equation enviroment should not be afffected.



      I have been trying for some hours but none of the answers seems to work :(



      Thanks in advance!!










      share|improve this question







      New contributor




      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am writting a report and I have multiple systems of equations. I want to avoid have too big numbers (Equation 4.200 for example) and I dont want to link the numbering to the chapter or the section.



      I want a personalized align enviroment that enummerates the equations as:



      (A1)



      (A2)



      (A3)



      The first time I use it and



      (B1)



      (B2)



      (B3)



      The second time I use and so on.



      The normal numeration of the usual align enviroment or equation enviroment should not be afffected.



      I have been trying for some hours but none of the answers seems to work :(



      Thanks in advance!!







      numbering align






      share|improve this question







      New contributor




      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 20 at 21:30









      Andrus

      132




      132




      New contributor




      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Andrus is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          We can locally change the equation counter (restoring it at the end). This also behaves well with label and ref.



          documentclass{article}
          usepackage{amsmath}

          newcounter{alphalign}
          renewcommand{thealphalign}{Alph{alphalign}}
          newcounter{alphalignsavedequation}

          newenvironment{alphalign}
          {%
          setcounter{alphalignsavedequation}{value{equation}}%
          counterwithin*{equation}{alphalign}%
          stepcounter{alphalign}%
          renewcommand{theequation}{thealphalignarabic{equation}}%
          align
          }
          {endalignsetcounter{equation}{value{alphalignsavedequation}}}

          begin{document}

          An equation
          begin{equation}
          0=0
          end{equation}
          An alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}
          Another alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}

          end{document}


          enter image description here






          share|improve this answer





















          • Works perfectly, thanks!
            – Andrus
            Nov 20 at 23:56


















          up vote
          1
          down vote













          The following code lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.



          enter image description here



          documentclass{article}

          usepackage{amsmath,alphalph}
          newcounter{selfalignprefix}
          newcounter{selfalign}[selfalignprefix]

          renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
          renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}

          makeatletter
          newenvironment{selfalign}
          {letc@equationc@selfalign% Make equation counter point to the selfalign counter
          stepcounter{selfalignprefix}% Step the prefix counter
          renewcommand{theequation}{theselfalign}% Update equation counter representation
          align}
          {endalign}
          makeatother

          begin{document}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          end{document}





          share|improve this answer





















          • Thanks for your help!
            – Andrus
            Nov 20 at 23:57











          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: 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
          });


          }
          });






          Andrus is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461029%2fdefine-a-new-align-environment-with-custom-numeration%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








          up vote
          2
          down vote



          accepted










          We can locally change the equation counter (restoring it at the end). This also behaves well with label and ref.



          documentclass{article}
          usepackage{amsmath}

          newcounter{alphalign}
          renewcommand{thealphalign}{Alph{alphalign}}
          newcounter{alphalignsavedequation}

          newenvironment{alphalign}
          {%
          setcounter{alphalignsavedequation}{value{equation}}%
          counterwithin*{equation}{alphalign}%
          stepcounter{alphalign}%
          renewcommand{theequation}{thealphalignarabic{equation}}%
          align
          }
          {endalignsetcounter{equation}{value{alphalignsavedequation}}}

          begin{document}

          An equation
          begin{equation}
          0=0
          end{equation}
          An alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}
          Another alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}

          end{document}


          enter image description here






          share|improve this answer





















          • Works perfectly, thanks!
            – Andrus
            Nov 20 at 23:56















          up vote
          2
          down vote



          accepted










          We can locally change the equation counter (restoring it at the end). This also behaves well with label and ref.



          documentclass{article}
          usepackage{amsmath}

          newcounter{alphalign}
          renewcommand{thealphalign}{Alph{alphalign}}
          newcounter{alphalignsavedequation}

          newenvironment{alphalign}
          {%
          setcounter{alphalignsavedequation}{value{equation}}%
          counterwithin*{equation}{alphalign}%
          stepcounter{alphalign}%
          renewcommand{theequation}{thealphalignarabic{equation}}%
          align
          }
          {endalignsetcounter{equation}{value{alphalignsavedequation}}}

          begin{document}

          An equation
          begin{equation}
          0=0
          end{equation}
          An alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}
          Another alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}

          end{document}


          enter image description here






          share|improve this answer





















          • Works perfectly, thanks!
            – Andrus
            Nov 20 at 23:56













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          We can locally change the equation counter (restoring it at the end). This also behaves well with label and ref.



          documentclass{article}
          usepackage{amsmath}

          newcounter{alphalign}
          renewcommand{thealphalign}{Alph{alphalign}}
          newcounter{alphalignsavedequation}

          newenvironment{alphalign}
          {%
          setcounter{alphalignsavedequation}{value{equation}}%
          counterwithin*{equation}{alphalign}%
          stepcounter{alphalign}%
          renewcommand{theequation}{thealphalignarabic{equation}}%
          align
          }
          {endalignsetcounter{equation}{value{alphalignsavedequation}}}

          begin{document}

          An equation
          begin{equation}
          0=0
          end{equation}
          An alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}
          Another alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}

          end{document}


          enter image description here






          share|improve this answer












          We can locally change the equation counter (restoring it at the end). This also behaves well with label and ref.



          documentclass{article}
          usepackage{amsmath}

          newcounter{alphalign}
          renewcommand{thealphalign}{Alph{alphalign}}
          newcounter{alphalignsavedequation}

          newenvironment{alphalign}
          {%
          setcounter{alphalignsavedequation}{value{equation}}%
          counterwithin*{equation}{alphalign}%
          stepcounter{alphalign}%
          renewcommand{theequation}{thealphalignarabic{equation}}%
          align
          }
          {endalignsetcounter{equation}{value{alphalignsavedequation}}}

          begin{document}

          An equation
          begin{equation}
          0=0
          end{equation}
          An alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}
          Another alignment with alpha
          begin{alphalign}
          0&=0\
          1&=1\
          2&=2
          end{alphalign}
          Another equation
          begin{equation}
          0=0
          end{equation}

          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 21:47









          egreg

          700k8518623136




          700k8518623136












          • Works perfectly, thanks!
            – Andrus
            Nov 20 at 23:56


















          • Works perfectly, thanks!
            – Andrus
            Nov 20 at 23:56
















          Works perfectly, thanks!
          – Andrus
          Nov 20 at 23:56




          Works perfectly, thanks!
          – Andrus
          Nov 20 at 23:56










          up vote
          1
          down vote













          The following code lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.



          enter image description here



          documentclass{article}

          usepackage{amsmath,alphalph}
          newcounter{selfalignprefix}
          newcounter{selfalign}[selfalignprefix]

          renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
          renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}

          makeatletter
          newenvironment{selfalign}
          {letc@equationc@selfalign% Make equation counter point to the selfalign counter
          stepcounter{selfalignprefix}% Step the prefix counter
          renewcommand{theequation}{theselfalign}% Update equation counter representation
          align}
          {endalign}
          makeatother

          begin{document}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          end{document}





          share|improve this answer





















          • Thanks for your help!
            – Andrus
            Nov 20 at 23:57















          up vote
          1
          down vote













          The following code lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.



          enter image description here



          documentclass{article}

          usepackage{amsmath,alphalph}
          newcounter{selfalignprefix}
          newcounter{selfalign}[selfalignprefix]

          renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
          renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}

          makeatletter
          newenvironment{selfalign}
          {letc@equationc@selfalign% Make equation counter point to the selfalign counter
          stepcounter{selfalignprefix}% Step the prefix counter
          renewcommand{theequation}{theselfalign}% Update equation counter representation
          align}
          {endalign}
          makeatother

          begin{document}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          end{document}





          share|improve this answer





















          • Thanks for your help!
            – Andrus
            Nov 20 at 23:57













          up vote
          1
          down vote










          up vote
          1
          down vote









          The following code lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.



          enter image description here



          documentclass{article}

          usepackage{amsmath,alphalph}
          newcounter{selfalignprefix}
          newcounter{selfalign}[selfalignprefix]

          renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
          renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}

          makeatletter
          newenvironment{selfalign}
          {letc@equationc@selfalign% Make equation counter point to the selfalign counter
          stepcounter{selfalignprefix}% Step the prefix counter
          renewcommand{theequation}{theselfalign}% Update equation counter representation
          align}
          {endalign}
          makeatother

          begin{document}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          end{document}





          share|improve this answer












          The following code lets the equation counter to another counter called selfalign within the newly-defined environment (group) selfalign. Since the let is scoped/temporary within the group, it reverts to the original definition afterwards. alphalph is used to ensure the selfalign counter prefix can roll over beyond Z, if needed.



          enter image description here



          documentclass{article}

          usepackage{amsmath,alphalph}
          newcounter{selfalignprefix}
          newcounter{selfalign}[selfalignprefix]

          renewcommand{theselfalignprefix}{AlphAlph{value{selfalignprefix}}}
          renewcommand{theselfalign}{theselfalignprefixarabic{selfalign}}

          makeatletter
          newenvironment{selfalign}
          {letc@equationc@selfalign% Make equation counter point to the selfalign counter
          stepcounter{selfalignprefix}% Step the prefix counter
          renewcommand{theequation}{theselfalign}% Update equation counter representation
          align}
          {endalign}
          makeatother

          begin{document}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          begin{align}
          f(x) \ g(x) \ h(x)
          end{align}

          begin{selfalign}
          f(x) \ g(x) \ h(x)
          end{selfalign}

          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 21:50









          Werner

          432k599501630




          432k599501630












          • Thanks for your help!
            – Andrus
            Nov 20 at 23:57


















          • Thanks for your help!
            – Andrus
            Nov 20 at 23:57
















          Thanks for your help!
          – Andrus
          Nov 20 at 23:57




          Thanks for your help!
          – Andrus
          Nov 20 at 23:57










          Andrus is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          Andrus is a new contributor. Be nice, and check out our Code of Conduct.













          Andrus is a new contributor. Be nice, and check out our Code of Conduct.












          Andrus is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461029%2fdefine-a-new-align-environment-with-custom-numeration%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

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?