Customize subequation numbering











up vote
3
down vote

favorite












I need to customize equation numbering as follows:



Some text ...

a+b (5)
3+2 (5')

... some more text....

c+d (6)


The idea is that (5') is an example of (5). I thought of using subequations, but I am not sure how to customize the inner numbering, as it would generate 5a and 5b, or 5.i, 5.ii, etc.... If I use tag{} instead, I am not sure how to get the previous equation number (5, in the example).










share|improve this question


























    up vote
    3
    down vote

    favorite












    I need to customize equation numbering as follows:



    Some text ...

    a+b (5)
    3+2 (5')

    ... some more text....

    c+d (6)


    The idea is that (5') is an example of (5). I thought of using subequations, but I am not sure how to customize the inner numbering, as it would generate 5a and 5b, or 5.i, 5.ii, etc.... If I use tag{} instead, I am not sure how to get the previous equation number (5, in the example).










    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I need to customize equation numbering as follows:



      Some text ...

      a+b (5)
      3+2 (5')

      ... some more text....

      c+d (6)


      The idea is that (5') is an example of (5). I thought of using subequations, but I am not sure how to customize the inner numbering, as it would generate 5a and 5b, or 5.i, 5.ii, etc.... If I use tag{} instead, I am not sure how to get the previous equation number (5, in the example).










      share|improve this question













      I need to customize equation numbering as follows:



      Some text ...

      a+b (5)
      3+2 (5')

      ... some more text....

      c+d (6)


      The idea is that (5') is an example of (5). I thought of using subequations, but I am not sure how to customize the inner numbering, as it would generate 5a and 5b, or 5.i, 5.ii, etc.... If I use tag{} instead, I am not sure how to get the previous equation number (5, in the example).







      equations amsmath subequations tag






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 20:00









      andy

      314




      314






















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          3
          down vote













          You can define an eqorn command. If you use eqorn[''] you get two primes; any math symbol can be specified in the optional argument.



          documentclass{article}
          usepackage{amsmath}

          newcommand{eqorn}[1][']{tag{theequationensuremath{#1}}}

          begin{document}

          Some text ...
          begin{gather}% or align or whatnot
          a+b label{main} \
          3+2 eqorn label{secondary}
          end{gather}
          ... some more text....
          begin{equation}
          c+d
          end{equation}
          with references to eqref{main} and eqref{secondary}.

          end{document}


          enter image description here






          share|improve this answer






























            up vote
            3
            down vote













            Here's an approach using expl3's prg_replicate:nn to produce n copies of ' to number the equations in subequations and etoolbox's patchcmd to insert that in the subequations environment.




            enter image description here




            documentclass{article}
            usepackage{amsmath}
            usepackage{expl3}

            % Creating a command to print a number of apostrophes
            ExplSyntaxOn
            cs_new:Npn apost #1
            { __andy_apost:cn { c@ #1 } }
            cs_new:Npn __andy_apost:Nn #1
            {
            ensuremath {
            prg_replicate:nn { #1 - 1 } { {'} }
            }
            }
            cs_generate_variant:Nn __andy_apost:Nn { c }
            ExplSyntaxOff

            % Patching-in that command in subequations
            usepackage{etoolbox}
            patchcmdsubequations
            {deftheequation{theparentequationalph{equation}}}
            {deftheequation{theparentequationapost{equation}}}
            {}{FAIL}

            begin{document}

            begin{subequations}
            begin{equation}
            a+b
            end{equation}
            begin{equation}
            3+2
            end{equation}
            begin{equation}
            5
            end{equation}
            end{subequations}

            end{document}





            share|improve this answer



















            • 1




              Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
              – egreg
              Nov 12 at 22:29










            • @egreg Better indeed. Thanks :-)
              – Phelype Oleinik
              Nov 12 at 23:20


















            up vote
            1
            down vote













            An alternative is the modified answer from here:



            documentclass{article}
            usepackage{amsmath}
            makeatletter
            newcommand*ifcounter[1]{%
            ifcsname c@#1endcsname%
            expandafter@firstoftwo%
            else%
            expandafter@secondoftwo%
            fi%
            }%
            makeatother



            newcommandEqFamTag[2][roman]{%
            ifcounter{#2}{%
            expandafteraddtocounter{#2}{1}%
            expandafteraddtocounter{#2Prev}{1}
            xdeftemp{csname #2 Eqendcsname ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
            tag{temp}%
            }{%
            globalexpandafternewcounter{#2}%
            globalexpandafternewcounter{#2Prev}
            expandafteraddtocounter{#2}{1}%
            xdeftemp{theequation ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
            xdefeqonfamily{theequation}%
            globalexpandafterletcsname #2 Eqendcsnameeqonfamily%
            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
            tag{temp}%
            expandafteraddtocounter{equation}{1}
            }%
            }%

            newcommandmyFamRef[2][1]{csname #2#1endcsname}

            begin{document}
            section{test}
            begin{equation}
            f(x)=3cdot x
            end{equation}

            begin{equation}
            x=4cdot y EqFamTag{MyFamily}
            end{equation}

            As an example:

            begin{equation}
            x=4cdot 2=8EqFamTag{MyFamily}
            end{equation}

            The equation: myFamRef[2]{MyFamily} is the first example/member of the equation myFamRef{MyFamily}

            begin{equation}
            x=4cdot y
            end{equation}

            Another example of :

            begin{equation}
            x=4cdot 2=8EqFamTag{MyFamily}
            end{equation}

            The equation: myFamRef[3]{MyFamily} is the second example/member of the equation myFamRef{MyFamily}

            Another family of equations is:

            begin{equation}
            f(x)=3+y EqFamTag{NewFam}
            end{equation}

            and a member of it is:

            begin{equation}
            f(6)=9 EqFamTag{NewFam}
            end{equation}

            end{document}


            Output:



            enter image description here






            share|improve this answer




























              up vote
              0
              down vote













              It is very easy to have a first (main) subequation numbered as an ordinary equation, the subequations standard numbering starting only at the second subequation:



              documentclass{article}
              usepackage{amsmath}
              setcounter{equation}{4}

              begin{document}
              Some text . . . . . .
              begin{subequations}
              addtocounter{equation}{-1}
              begin{gather}
              a+b label{main} \
              3+2 label{ex-1} \
              5label{ex-2}
              end{gather}
              end{subequations}.
              . . . . . .Some more text . . . . . .
              begin{equation}
              c + d
              end{equation}

              eqref{ex-1} and eqref{ex-2} illustrate eqref{main}.

              end{document}


              enter image description here






              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',
                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%2f459681%2fcustomize-subequation-numbering%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                3
                down vote













                You can define an eqorn command. If you use eqorn[''] you get two primes; any math symbol can be specified in the optional argument.



                documentclass{article}
                usepackage{amsmath}

                newcommand{eqorn}[1][']{tag{theequationensuremath{#1}}}

                begin{document}

                Some text ...
                begin{gather}% or align or whatnot
                a+b label{main} \
                3+2 eqorn label{secondary}
                end{gather}
                ... some more text....
                begin{equation}
                c+d
                end{equation}
                with references to eqref{main} and eqref{secondary}.

                end{document}


                enter image description here






                share|improve this answer



























                  up vote
                  3
                  down vote













                  You can define an eqorn command. If you use eqorn[''] you get two primes; any math symbol can be specified in the optional argument.



                  documentclass{article}
                  usepackage{amsmath}

                  newcommand{eqorn}[1][']{tag{theequationensuremath{#1}}}

                  begin{document}

                  Some text ...
                  begin{gather}% or align or whatnot
                  a+b label{main} \
                  3+2 eqorn label{secondary}
                  end{gather}
                  ... some more text....
                  begin{equation}
                  c+d
                  end{equation}
                  with references to eqref{main} and eqref{secondary}.

                  end{document}


                  enter image description here






                  share|improve this answer

























                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    You can define an eqorn command. If you use eqorn[''] you get two primes; any math symbol can be specified in the optional argument.



                    documentclass{article}
                    usepackage{amsmath}

                    newcommand{eqorn}[1][']{tag{theequationensuremath{#1}}}

                    begin{document}

                    Some text ...
                    begin{gather}% or align or whatnot
                    a+b label{main} \
                    3+2 eqorn label{secondary}
                    end{gather}
                    ... some more text....
                    begin{equation}
                    c+d
                    end{equation}
                    with references to eqref{main} and eqref{secondary}.

                    end{document}


                    enter image description here






                    share|improve this answer














                    You can define an eqorn command. If you use eqorn[''] you get two primes; any math symbol can be specified in the optional argument.



                    documentclass{article}
                    usepackage{amsmath}

                    newcommand{eqorn}[1][']{tag{theequationensuremath{#1}}}

                    begin{document}

                    Some text ...
                    begin{gather}% or align or whatnot
                    a+b label{main} \
                    3+2 eqorn label{secondary}
                    end{gather}
                    ... some more text....
                    begin{equation}
                    c+d
                    end{equation}
                    with references to eqref{main} and eqref{secondary}.

                    end{document}


                    enter image description here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 12 at 22:38

























                    answered Nov 12 at 22:33









                    egreg

                    697k8518513118




                    697k8518513118






















                        up vote
                        3
                        down vote













                        Here's an approach using expl3's prg_replicate:nn to produce n copies of ' to number the equations in subequations and etoolbox's patchcmd to insert that in the subequations environment.




                        enter image description here




                        documentclass{article}
                        usepackage{amsmath}
                        usepackage{expl3}

                        % Creating a command to print a number of apostrophes
                        ExplSyntaxOn
                        cs_new:Npn apost #1
                        { __andy_apost:cn { c@ #1 } }
                        cs_new:Npn __andy_apost:Nn #1
                        {
                        ensuremath {
                        prg_replicate:nn { #1 - 1 } { {'} }
                        }
                        }
                        cs_generate_variant:Nn __andy_apost:Nn { c }
                        ExplSyntaxOff

                        % Patching-in that command in subequations
                        usepackage{etoolbox}
                        patchcmdsubequations
                        {deftheequation{theparentequationalph{equation}}}
                        {deftheequation{theparentequationapost{equation}}}
                        {}{FAIL}

                        begin{document}

                        begin{subequations}
                        begin{equation}
                        a+b
                        end{equation}
                        begin{equation}
                        3+2
                        end{equation}
                        begin{equation}
                        5
                        end{equation}
                        end{subequations}

                        end{document}





                        share|improve this answer



















                        • 1




                          Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                          – egreg
                          Nov 12 at 22:29










                        • @egreg Better indeed. Thanks :-)
                          – Phelype Oleinik
                          Nov 12 at 23:20















                        up vote
                        3
                        down vote













                        Here's an approach using expl3's prg_replicate:nn to produce n copies of ' to number the equations in subequations and etoolbox's patchcmd to insert that in the subequations environment.




                        enter image description here




                        documentclass{article}
                        usepackage{amsmath}
                        usepackage{expl3}

                        % Creating a command to print a number of apostrophes
                        ExplSyntaxOn
                        cs_new:Npn apost #1
                        { __andy_apost:cn { c@ #1 } }
                        cs_new:Npn __andy_apost:Nn #1
                        {
                        ensuremath {
                        prg_replicate:nn { #1 - 1 } { {'} }
                        }
                        }
                        cs_generate_variant:Nn __andy_apost:Nn { c }
                        ExplSyntaxOff

                        % Patching-in that command in subequations
                        usepackage{etoolbox}
                        patchcmdsubequations
                        {deftheequation{theparentequationalph{equation}}}
                        {deftheequation{theparentequationapost{equation}}}
                        {}{FAIL}

                        begin{document}

                        begin{subequations}
                        begin{equation}
                        a+b
                        end{equation}
                        begin{equation}
                        3+2
                        end{equation}
                        begin{equation}
                        5
                        end{equation}
                        end{subequations}

                        end{document}





                        share|improve this answer



















                        • 1




                          Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                          – egreg
                          Nov 12 at 22:29










                        • @egreg Better indeed. Thanks :-)
                          – Phelype Oleinik
                          Nov 12 at 23:20













                        up vote
                        3
                        down vote










                        up vote
                        3
                        down vote









                        Here's an approach using expl3's prg_replicate:nn to produce n copies of ' to number the equations in subequations and etoolbox's patchcmd to insert that in the subequations environment.




                        enter image description here




                        documentclass{article}
                        usepackage{amsmath}
                        usepackage{expl3}

                        % Creating a command to print a number of apostrophes
                        ExplSyntaxOn
                        cs_new:Npn apost #1
                        { __andy_apost:cn { c@ #1 } }
                        cs_new:Npn __andy_apost:Nn #1
                        {
                        ensuremath {
                        prg_replicate:nn { #1 - 1 } { {'} }
                        }
                        }
                        cs_generate_variant:Nn __andy_apost:Nn { c }
                        ExplSyntaxOff

                        % Patching-in that command in subequations
                        usepackage{etoolbox}
                        patchcmdsubequations
                        {deftheequation{theparentequationalph{equation}}}
                        {deftheequation{theparentequationapost{equation}}}
                        {}{FAIL}

                        begin{document}

                        begin{subequations}
                        begin{equation}
                        a+b
                        end{equation}
                        begin{equation}
                        3+2
                        end{equation}
                        begin{equation}
                        5
                        end{equation}
                        end{subequations}

                        end{document}





                        share|improve this answer














                        Here's an approach using expl3's prg_replicate:nn to produce n copies of ' to number the equations in subequations and etoolbox's patchcmd to insert that in the subequations environment.




                        enter image description here




                        documentclass{article}
                        usepackage{amsmath}
                        usepackage{expl3}

                        % Creating a command to print a number of apostrophes
                        ExplSyntaxOn
                        cs_new:Npn apost #1
                        { __andy_apost:cn { c@ #1 } }
                        cs_new:Npn __andy_apost:Nn #1
                        {
                        ensuremath {
                        prg_replicate:nn { #1 - 1 } { {'} }
                        }
                        }
                        cs_generate_variant:Nn __andy_apost:Nn { c }
                        ExplSyntaxOff

                        % Patching-in that command in subequations
                        usepackage{etoolbox}
                        patchcmdsubequations
                        {deftheequation{theparentequationalph{equation}}}
                        {deftheequation{theparentequationapost{equation}}}
                        {}{FAIL}

                        begin{document}

                        begin{subequations}
                        begin{equation}
                        a+b
                        end{equation}
                        begin{equation}
                        3+2
                        end{equation}
                        begin{equation}
                        5
                        end{equation}
                        end{subequations}

                        end{document}






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Nov 12 at 23:20

























                        answered Nov 12 at 20:57









                        Phelype Oleinik

                        20.1k54277




                        20.1k54277








                        • 1




                          Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                          – egreg
                          Nov 12 at 22:29










                        • @egreg Better indeed. Thanks :-)
                          – Phelype Oleinik
                          Nov 12 at 23:20














                        • 1




                          Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                          – egreg
                          Nov 12 at 22:29










                        • @egreg Better indeed. Thanks :-)
                          – Phelype Oleinik
                          Nov 12 at 23:20








                        1




                        1




                        Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                        – egreg
                        Nov 12 at 22:29




                        Possibly ensuremath{prg_replicate:nn { #1 - 1 }{'}} gives a better output.
                        – egreg
                        Nov 12 at 22:29












                        @egreg Better indeed. Thanks :-)
                        – Phelype Oleinik
                        Nov 12 at 23:20




                        @egreg Better indeed. Thanks :-)
                        – Phelype Oleinik
                        Nov 12 at 23:20










                        up vote
                        1
                        down vote













                        An alternative is the modified answer from here:



                        documentclass{article}
                        usepackage{amsmath}
                        makeatletter
                        newcommand*ifcounter[1]{%
                        ifcsname c@#1endcsname%
                        expandafter@firstoftwo%
                        else%
                        expandafter@secondoftwo%
                        fi%
                        }%
                        makeatother



                        newcommandEqFamTag[2][roman]{%
                        ifcounter{#2}{%
                        expandafteraddtocounter{#2}{1}%
                        expandafteraddtocounter{#2Prev}{1}
                        xdeftemp{csname #2 Eqendcsname ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                        globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                        tag{temp}%
                        }{%
                        globalexpandafternewcounter{#2}%
                        globalexpandafternewcounter{#2Prev}
                        expandafteraddtocounter{#2}{1}%
                        xdeftemp{theequation ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                        xdefeqonfamily{theequation}%
                        globalexpandafterletcsname #2 Eqendcsnameeqonfamily%
                        globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                        tag{temp}%
                        expandafteraddtocounter{equation}{1}
                        }%
                        }%

                        newcommandmyFamRef[2][1]{csname #2#1endcsname}

                        begin{document}
                        section{test}
                        begin{equation}
                        f(x)=3cdot x
                        end{equation}

                        begin{equation}
                        x=4cdot y EqFamTag{MyFamily}
                        end{equation}

                        As an example:

                        begin{equation}
                        x=4cdot 2=8EqFamTag{MyFamily}
                        end{equation}

                        The equation: myFamRef[2]{MyFamily} is the first example/member of the equation myFamRef{MyFamily}

                        begin{equation}
                        x=4cdot y
                        end{equation}

                        Another example of :

                        begin{equation}
                        x=4cdot 2=8EqFamTag{MyFamily}
                        end{equation}

                        The equation: myFamRef[3]{MyFamily} is the second example/member of the equation myFamRef{MyFamily}

                        Another family of equations is:

                        begin{equation}
                        f(x)=3+y EqFamTag{NewFam}
                        end{equation}

                        and a member of it is:

                        begin{equation}
                        f(6)=9 EqFamTag{NewFam}
                        end{equation}

                        end{document}


                        Output:



                        enter image description here






                        share|improve this answer

























                          up vote
                          1
                          down vote













                          An alternative is the modified answer from here:



                          documentclass{article}
                          usepackage{amsmath}
                          makeatletter
                          newcommand*ifcounter[1]{%
                          ifcsname c@#1endcsname%
                          expandafter@firstoftwo%
                          else%
                          expandafter@secondoftwo%
                          fi%
                          }%
                          makeatother



                          newcommandEqFamTag[2][roman]{%
                          ifcounter{#2}{%
                          expandafteraddtocounter{#2}{1}%
                          expandafteraddtocounter{#2Prev}{1}
                          xdeftemp{csname #2 Eqendcsname ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                          globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                          tag{temp}%
                          }{%
                          globalexpandafternewcounter{#2}%
                          globalexpandafternewcounter{#2Prev}
                          expandafteraddtocounter{#2}{1}%
                          xdeftemp{theequation ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                          xdefeqonfamily{theequation}%
                          globalexpandafterletcsname #2 Eqendcsnameeqonfamily%
                          globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                          tag{temp}%
                          expandafteraddtocounter{equation}{1}
                          }%
                          }%

                          newcommandmyFamRef[2][1]{csname #2#1endcsname}

                          begin{document}
                          section{test}
                          begin{equation}
                          f(x)=3cdot x
                          end{equation}

                          begin{equation}
                          x=4cdot y EqFamTag{MyFamily}
                          end{equation}

                          As an example:

                          begin{equation}
                          x=4cdot 2=8EqFamTag{MyFamily}
                          end{equation}

                          The equation: myFamRef[2]{MyFamily} is the first example/member of the equation myFamRef{MyFamily}

                          begin{equation}
                          x=4cdot y
                          end{equation}

                          Another example of :

                          begin{equation}
                          x=4cdot 2=8EqFamTag{MyFamily}
                          end{equation}

                          The equation: myFamRef[3]{MyFamily} is the second example/member of the equation myFamRef{MyFamily}

                          Another family of equations is:

                          begin{equation}
                          f(x)=3+y EqFamTag{NewFam}
                          end{equation}

                          and a member of it is:

                          begin{equation}
                          f(6)=9 EqFamTag{NewFam}
                          end{equation}

                          end{document}


                          Output:



                          enter image description here






                          share|improve this answer























                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            An alternative is the modified answer from here:



                            documentclass{article}
                            usepackage{amsmath}
                            makeatletter
                            newcommand*ifcounter[1]{%
                            ifcsname c@#1endcsname%
                            expandafter@firstoftwo%
                            else%
                            expandafter@secondoftwo%
                            fi%
                            }%
                            makeatother



                            newcommandEqFamTag[2][roman]{%
                            ifcounter{#2}{%
                            expandafteraddtocounter{#2}{1}%
                            expandafteraddtocounter{#2Prev}{1}
                            xdeftemp{csname #2 Eqendcsname ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                            tag{temp}%
                            }{%
                            globalexpandafternewcounter{#2}%
                            globalexpandafternewcounter{#2Prev}
                            expandafteraddtocounter{#2}{1}%
                            xdeftemp{theequation ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                            xdefeqonfamily{theequation}%
                            globalexpandafterletcsname #2 Eqendcsnameeqonfamily%
                            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                            tag{temp}%
                            expandafteraddtocounter{equation}{1}
                            }%
                            }%

                            newcommandmyFamRef[2][1]{csname #2#1endcsname}

                            begin{document}
                            section{test}
                            begin{equation}
                            f(x)=3cdot x
                            end{equation}

                            begin{equation}
                            x=4cdot y EqFamTag{MyFamily}
                            end{equation}

                            As an example:

                            begin{equation}
                            x=4cdot 2=8EqFamTag{MyFamily}
                            end{equation}

                            The equation: myFamRef[2]{MyFamily} is the first example/member of the equation myFamRef{MyFamily}

                            begin{equation}
                            x=4cdot y
                            end{equation}

                            Another example of :

                            begin{equation}
                            x=4cdot 2=8EqFamTag{MyFamily}
                            end{equation}

                            The equation: myFamRef[3]{MyFamily} is the second example/member of the equation myFamRef{MyFamily}

                            Another family of equations is:

                            begin{equation}
                            f(x)=3+y EqFamTag{NewFam}
                            end{equation}

                            and a member of it is:

                            begin{equation}
                            f(6)=9 EqFamTag{NewFam}
                            end{equation}

                            end{document}


                            Output:



                            enter image description here






                            share|improve this answer












                            An alternative is the modified answer from here:



                            documentclass{article}
                            usepackage{amsmath}
                            makeatletter
                            newcommand*ifcounter[1]{%
                            ifcsname c@#1endcsname%
                            expandafter@firstoftwo%
                            else%
                            expandafter@secondoftwo%
                            fi%
                            }%
                            makeatother



                            newcommandEqFamTag[2][roman]{%
                            ifcounter{#2}{%
                            expandafteraddtocounter{#2}{1}%
                            expandafteraddtocounter{#2Prev}{1}
                            xdeftemp{csname #2 Eqendcsname ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                            tag{temp}%
                            }{%
                            globalexpandafternewcounter{#2}%
                            globalexpandafternewcounter{#2Prev}
                            expandafteraddtocounter{#2}{1}%
                            xdeftemp{theequation ifnumvalue{#2Prev}>0 space(csname #1endcsname{#2Prev})fi}%
                            xdefeqonfamily{theequation}%
                            globalexpandafterletcsname #2 Eqendcsnameeqonfamily%
                            globalexpandafterletcsname #2arabic{#2}endcsnametemp%
                            tag{temp}%
                            expandafteraddtocounter{equation}{1}
                            }%
                            }%

                            newcommandmyFamRef[2][1]{csname #2#1endcsname}

                            begin{document}
                            section{test}
                            begin{equation}
                            f(x)=3cdot x
                            end{equation}

                            begin{equation}
                            x=4cdot y EqFamTag{MyFamily}
                            end{equation}

                            As an example:

                            begin{equation}
                            x=4cdot 2=8EqFamTag{MyFamily}
                            end{equation}

                            The equation: myFamRef[2]{MyFamily} is the first example/member of the equation myFamRef{MyFamily}

                            begin{equation}
                            x=4cdot y
                            end{equation}

                            Another example of :

                            begin{equation}
                            x=4cdot 2=8EqFamTag{MyFamily}
                            end{equation}

                            The equation: myFamRef[3]{MyFamily} is the second example/member of the equation myFamRef{MyFamily}

                            Another family of equations is:

                            begin{equation}
                            f(x)=3+y EqFamTag{NewFam}
                            end{equation}

                            and a member of it is:

                            begin{equation}
                            f(6)=9 EqFamTag{NewFam}
                            end{equation}

                            end{document}


                            Output:



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 12 at 22:03









                            koleygr

                            10.8k1837




                            10.8k1837






















                                up vote
                                0
                                down vote













                                It is very easy to have a first (main) subequation numbered as an ordinary equation, the subequations standard numbering starting only at the second subequation:



                                documentclass{article}
                                usepackage{amsmath}
                                setcounter{equation}{4}

                                begin{document}
                                Some text . . . . . .
                                begin{subequations}
                                addtocounter{equation}{-1}
                                begin{gather}
                                a+b label{main} \
                                3+2 label{ex-1} \
                                5label{ex-2}
                                end{gather}
                                end{subequations}.
                                . . . . . .Some more text . . . . . .
                                begin{equation}
                                c + d
                                end{equation}

                                eqref{ex-1} and eqref{ex-2} illustrate eqref{main}.

                                end{document}


                                enter image description here






                                share|improve this answer

























                                  up vote
                                  0
                                  down vote













                                  It is very easy to have a first (main) subequation numbered as an ordinary equation, the subequations standard numbering starting only at the second subequation:



                                  documentclass{article}
                                  usepackage{amsmath}
                                  setcounter{equation}{4}

                                  begin{document}
                                  Some text . . . . . .
                                  begin{subequations}
                                  addtocounter{equation}{-1}
                                  begin{gather}
                                  a+b label{main} \
                                  3+2 label{ex-1} \
                                  5label{ex-2}
                                  end{gather}
                                  end{subequations}.
                                  . . . . . .Some more text . . . . . .
                                  begin{equation}
                                  c + d
                                  end{equation}

                                  eqref{ex-1} and eqref{ex-2} illustrate eqref{main}.

                                  end{document}


                                  enter image description here






                                  share|improve this answer























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    It is very easy to have a first (main) subequation numbered as an ordinary equation, the subequations standard numbering starting only at the second subequation:



                                    documentclass{article}
                                    usepackage{amsmath}
                                    setcounter{equation}{4}

                                    begin{document}
                                    Some text . . . . . .
                                    begin{subequations}
                                    addtocounter{equation}{-1}
                                    begin{gather}
                                    a+b label{main} \
                                    3+2 label{ex-1} \
                                    5label{ex-2}
                                    end{gather}
                                    end{subequations}.
                                    . . . . . .Some more text . . . . . .
                                    begin{equation}
                                    c + d
                                    end{equation}

                                    eqref{ex-1} and eqref{ex-2} illustrate eqref{main}.

                                    end{document}


                                    enter image description here






                                    share|improve this answer












                                    It is very easy to have a first (main) subequation numbered as an ordinary equation, the subequations standard numbering starting only at the second subequation:



                                    documentclass{article}
                                    usepackage{amsmath}
                                    setcounter{equation}{4}

                                    begin{document}
                                    Some text . . . . . .
                                    begin{subequations}
                                    addtocounter{equation}{-1}
                                    begin{gather}
                                    a+b label{main} \
                                    3+2 label{ex-1} \
                                    5label{ex-2}
                                    end{gather}
                                    end{subequations}.
                                    . . . . . .Some more text . . . . . .
                                    begin{equation}
                                    c + d
                                    end{equation}

                                    eqref{ex-1} and eqref{ex-2} illustrate eqref{main}.

                                    end{document}


                                    enter image description here







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 12 at 21:22









                                    Bernard

                                    161k767192




                                    161k767192






























                                         

                                        draft saved


                                        draft discarded



















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459681%2fcustomize-subequation-numbering%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?