How to enumerate figures in sync with another counter?Numbering figuresHow to make equations, figures and theorems use the same numbering schemeSpacing issue in new environment from a theoremAdvanced hierarchical counting for theoremsHow can I set customized separators for theorem counters?Figure/Tables/Equations… countersDifficulty with Subfig: Aligning Figures on CenterlineHow to show also the name of the parent counter with cleveref?Let equation numbers and enumerate use the same counter

Digital Bananas

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

Does the DOJ's declining to investigate the Trump-Zelensky call ruin the basis for impeachment?

How is погода (weather) a count noun?

What is the Japanese equivalent of 'you're in my heart'?

Is there a pattern for handling conflicting function parameters?

Why is there such a singular place for bird watching?

Booting Ubuntu from USB drive on MSI motherboard -- EVERYTHING fails

Should I be an author on another PhD student's paper if I went to their meetings and gave advice?

Sending mail to the Professor for PhD, after seeing his tweet

How to protect bash function from being overridden?

How do we know Nemesis is not a black hole (or neutron star)?

If I travelled back in time to invest in X company to make a fortune, roughly what is the probability that it would fail?

Anonymous reviewer disclosed his identity. Should I thank him by name?

Did the Soviet army intentionally send troops (e.g. penal battalions) running over minefields?

Why not add cuspidal curves in the moduli space of stable curves?

Where does the image of a data connector as a sharp metal spike originate from?

Is it appropriate to "shop" through high-impact journals before sending the paper to more specialized journals?

Is "Ram married his daughter" ambiguous?

Why do personal finance apps focus on outgoings rather than income

Did Joe Biden "stop a prosecution" into his son in Ukraine? And did he brag about stopping the prosecution?

What makes a character irredeemable?

Why Vegetable Stock is bitter, but Chicken Stock not?

underline alignment



How to enumerate figures in sync with another counter?


Numbering figuresHow to make equations, figures and theorems use the same numbering schemeSpacing issue in new environment from a theoremAdvanced hierarchical counting for theoremsHow can I set customized separators for theorem counters?Figure/Tables/Equations… countersDifficulty with Subfig: Aligning Figures on CenterlineHow to show also the name of the parent counter with cleveref?Let equation numbers and enumerate use the same counter






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









2















I when I create a command for (for example) the examples in my article, I do it in this way:



newtheoremteoTheorem[section]
newtheoremex[teo]Example


So the enumeration is consecuent to what I have done with the theorems and other things, but the figures do their own enumeration, how can I change that in the same way of the examples? Thanks










share|improve this question


























  • Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

    – J.Rodriguez
    Apr 16 at 3:31











  • Did you see this answer to the query Numbering figures?

    – Mico
    Apr 16 at 4:30

















2















I when I create a command for (for example) the examples in my article, I do it in this way:



newtheoremteoTheorem[section]
newtheoremex[teo]Example


So the enumeration is consecuent to what I have done with the theorems and other things, but the figures do their own enumeration, how can I change that in the same way of the examples? Thanks










share|improve this question


























  • Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

    – J.Rodriguez
    Apr 16 at 3:31











  • Did you see this answer to the query Numbering figures?

    – Mico
    Apr 16 at 4:30













2












2








2








I when I create a command for (for example) the examples in my article, I do it in this way:



newtheoremteoTheorem[section]
newtheoremex[teo]Example


So the enumeration is consecuent to what I have done with the theorems and other things, but the figures do their own enumeration, how can I change that in the same way of the examples? Thanks










share|improve this question
















I when I create a command for (for example) the examples in my article, I do it in this way:



newtheoremteoTheorem[section]
newtheoremex[teo]Example


So the enumeration is consecuent to what I have done with the theorems and other things, but the figures do their own enumeration, how can I change that in the same way of the examples? Thanks







floats counters






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 16 at 22:47









Andrew

34.3k3 gold badges50 silver badges88 bronze badges




34.3k3 gold badges50 silver badges88 bronze badges










asked Apr 16 at 3:15









J.RodriguezJ.Rodriguez

3939 bronze badges




3939 bronze badges















  • Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

    – J.Rodriguez
    Apr 16 at 3:31











  • Did you see this answer to the query Numbering figures?

    – Mico
    Apr 16 at 4:30

















  • Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

    – J.Rodriguez
    Apr 16 at 3:31











  • Did you see this answer to the query Numbering figures?

    – Mico
    Apr 16 at 4:30
















Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

– J.Rodriguez
Apr 16 at 3:31





Exactly, for example, if there is a figure between theorem 2.3, and example 2.4, I want them to be, theorem 2.3, figure 2.4, and example 2.5

– J.Rodriguez
Apr 16 at 3:31













Did you see this answer to the query Numbering figures?

– Mico
Apr 16 at 4:30





Did you see this answer to the query Numbering figures?

– Mico
Apr 16 at 4:30










2 Answers
2






active

oldest

votes


















4
















You can essentially use the same approach as in your MWE except that you use figure to number your theorems:



numberwithinfiguresection% number figures inside sections
newtheoremteo[figure]Theorem
newtheoremex[figure]Example


The numberwithin command, which comes from amsmath, numbers the figures in tandem with the sections. Using this approach you can get the output



enter image description here



using the code:



documentclassamsart
numberwithinfiguresection
newtheoremteo[figure]Theorem
newtheoremex[figure]Example

begindocument

sectionLet the section begin

beginteoThe sum of two numbers is a numberlabelT:oneendteo

beginfigure[h]A figurecaptionNice onelabelF:oneendfigure

beginexFor example, $1+2=3$.labelE:oneendex

See refT:one, refF:one and refE:one.

enddocument





share|improve this answer



























  • This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

    – barbara beeton
    Apr 16 at 19:10











  • @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

    – Andrew
    Apr 16 at 21:40











  • Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

    – barbara beeton
    Apr 16 at 23:21


















1
















Here's a solution that employs the xassoccnt package to couple the teo and figure counters.



enter image description here



documentclassreport

usepackageamsthm
newtheoremteoTheorem[section]
newtheoremex[teo]Example

usepackagexassoccnt
DeclareCoupledCounters[name=figurteo]figure,teo
renewcommandthefigurethesection.arabicfigure

% just to allow 4 floats on a page:
setcountertotalnumber4
setcountertopnumber4

begindocument

% just for this example
setcounterchapter2
setcountersection3

beginteoIn the beginning, dots endteo
beginteoAfter a while, dotsendteo
beginfigure[ht]captionFeeendfigure
beginfigure[ht]captionFiendfigure
beginfigure[ht]captionFoendfigure
beginfigure[ht]captionFumendfigure
beginexAnd then, dotsendex
beginexFinally, dotsendex

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/4.0/"u003ecc by-sa 4.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%2f485068%2fhow-to-enumerate-figures-in-sync-with-another-counter%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









    4
















    You can essentially use the same approach as in your MWE except that you use figure to number your theorems:



    numberwithinfiguresection% number figures inside sections
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example


    The numberwithin command, which comes from amsmath, numbers the figures in tandem with the sections. Using this approach you can get the output



    enter image description here



    using the code:



    documentclassamsart
    numberwithinfiguresection
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example

    begindocument

    sectionLet the section begin

    beginteoThe sum of two numbers is a numberlabelT:oneendteo

    beginfigure[h]A figurecaptionNice onelabelF:oneendfigure

    beginexFor example, $1+2=3$.labelE:oneendex

    See refT:one, refF:one and refE:one.

    enddocument





    share|improve this answer



























    • This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

      – barbara beeton
      Apr 16 at 19:10











    • @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

      – Andrew
      Apr 16 at 21:40











    • Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

      – barbara beeton
      Apr 16 at 23:21















    4
















    You can essentially use the same approach as in your MWE except that you use figure to number your theorems:



    numberwithinfiguresection% number figures inside sections
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example


    The numberwithin command, which comes from amsmath, numbers the figures in tandem with the sections. Using this approach you can get the output



    enter image description here



    using the code:



    documentclassamsart
    numberwithinfiguresection
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example

    begindocument

    sectionLet the section begin

    beginteoThe sum of two numbers is a numberlabelT:oneendteo

    beginfigure[h]A figurecaptionNice onelabelF:oneendfigure

    beginexFor example, $1+2=3$.labelE:oneendex

    See refT:one, refF:one and refE:one.

    enddocument





    share|improve this answer



























    • This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

      – barbara beeton
      Apr 16 at 19:10











    • @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

      – Andrew
      Apr 16 at 21:40











    • Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

      – barbara beeton
      Apr 16 at 23:21













    4














    4










    4









    You can essentially use the same approach as in your MWE except that you use figure to number your theorems:



    numberwithinfiguresection% number figures inside sections
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example


    The numberwithin command, which comes from amsmath, numbers the figures in tandem with the sections. Using this approach you can get the output



    enter image description here



    using the code:



    documentclassamsart
    numberwithinfiguresection
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example

    begindocument

    sectionLet the section begin

    beginteoThe sum of two numbers is a numberlabelT:oneendteo

    beginfigure[h]A figurecaptionNice onelabelF:oneendfigure

    beginexFor example, $1+2=3$.labelE:oneendex

    See refT:one, refF:one and refE:one.

    enddocument





    share|improve this answer















    You can essentially use the same approach as in your MWE except that you use figure to number your theorems:



    numberwithinfiguresection% number figures inside sections
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example


    The numberwithin command, which comes from amsmath, numbers the figures in tandem with the sections. Using this approach you can get the output



    enter image description here



    using the code:



    documentclassamsart
    numberwithinfiguresection
    newtheoremteo[figure]Theorem
    newtheoremex[figure]Example

    begindocument

    sectionLet the section begin

    beginteoThe sum of two numbers is a numberlabelT:oneendteo

    beginfigure[h]A figurecaptionNice onelabelF:oneendfigure

    beginexFor example, $1+2=3$.labelE:oneendex

    See refT:one, refF:one and refE:one.

    enddocument






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 16 at 4:45

























    answered Apr 16 at 4:38









    AndrewAndrew

    34.3k3 gold badges50 silver badges88 bronze badges




    34.3k3 gold badges50 silver badges88 bronze badges















    • This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

      – barbara beeton
      Apr 16 at 19:10











    • @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

      – Andrew
      Apr 16 at 21:40











    • Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

      – barbara beeton
      Apr 16 at 23:21

















    • This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

      – barbara beeton
      Apr 16 at 19:10











    • @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

      – Andrew
      Apr 16 at 21:40











    • Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

      – barbara beeton
      Apr 16 at 23:21
















    This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

    – barbara beeton
    Apr 16 at 19:10





    This answer depends on the use of the amsart document class. But that's not necessary -- article plus amsthm gives the same result.

    – barbara beeton
    Apr 16 at 19:10













    @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

    – Andrew
    Apr 16 at 21:40





    @barbarabeeton As the OP didn't provide a MWE with a document class I took the liberty of using my preferred article class, which is amsart. Using article and amsthm does not work as this gives an "Undefined control sequence" error for numberwithin. Of course, you could use makeatletter@addtoresetfiguresectionmakeatother with the article document class.

    – Andrew
    Apr 16 at 21:40













    Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

    – barbara beeton
    Apr 16 at 23:21





    Ah! Forgot that. Easily fixed -- usepackageamsmath. (Rash assumption -- if one is using amsthm, one is probably already using amsmath. Nice to hear that amsart is your favorite, but not everyone has the same preferences.)

    – barbara beeton
    Apr 16 at 23:21













    1
















    Here's a solution that employs the xassoccnt package to couple the teo and figure counters.



    enter image description here



    documentclassreport

    usepackageamsthm
    newtheoremteoTheorem[section]
    newtheoremex[teo]Example

    usepackagexassoccnt
    DeclareCoupledCounters[name=figurteo]figure,teo
    renewcommandthefigurethesection.arabicfigure

    % just to allow 4 floats on a page:
    setcountertotalnumber4
    setcountertopnumber4

    begindocument

    % just for this example
    setcounterchapter2
    setcountersection3

    beginteoIn the beginning, dots endteo
    beginteoAfter a while, dotsendteo
    beginfigure[ht]captionFeeendfigure
    beginfigure[ht]captionFiendfigure
    beginfigure[ht]captionFoendfigure
    beginfigure[ht]captionFumendfigure
    beginexAnd then, dotsendex
    beginexFinally, dotsendex

    enddocument





    share|improve this answer





























      1
















      Here's a solution that employs the xassoccnt package to couple the teo and figure counters.



      enter image description here



      documentclassreport

      usepackageamsthm
      newtheoremteoTheorem[section]
      newtheoremex[teo]Example

      usepackagexassoccnt
      DeclareCoupledCounters[name=figurteo]figure,teo
      renewcommandthefigurethesection.arabicfigure

      % just to allow 4 floats on a page:
      setcountertotalnumber4
      setcountertopnumber4

      begindocument

      % just for this example
      setcounterchapter2
      setcountersection3

      beginteoIn the beginning, dots endteo
      beginteoAfter a while, dotsendteo
      beginfigure[ht]captionFeeendfigure
      beginfigure[ht]captionFiendfigure
      beginfigure[ht]captionFoendfigure
      beginfigure[ht]captionFumendfigure
      beginexAnd then, dotsendex
      beginexFinally, dotsendex

      enddocument





      share|improve this answer



























        1














        1










        1









        Here's a solution that employs the xassoccnt package to couple the teo and figure counters.



        enter image description here



        documentclassreport

        usepackageamsthm
        newtheoremteoTheorem[section]
        newtheoremex[teo]Example

        usepackagexassoccnt
        DeclareCoupledCounters[name=figurteo]figure,teo
        renewcommandthefigurethesection.arabicfigure

        % just to allow 4 floats on a page:
        setcountertotalnumber4
        setcountertopnumber4

        begindocument

        % just for this example
        setcounterchapter2
        setcountersection3

        beginteoIn the beginning, dots endteo
        beginteoAfter a while, dotsendteo
        beginfigure[ht]captionFeeendfigure
        beginfigure[ht]captionFiendfigure
        beginfigure[ht]captionFoendfigure
        beginfigure[ht]captionFumendfigure
        beginexAnd then, dotsendex
        beginexFinally, dotsendex

        enddocument





        share|improve this answer













        Here's a solution that employs the xassoccnt package to couple the teo and figure counters.



        enter image description here



        documentclassreport

        usepackageamsthm
        newtheoremteoTheorem[section]
        newtheoremex[teo]Example

        usepackagexassoccnt
        DeclareCoupledCounters[name=figurteo]figure,teo
        renewcommandthefigurethesection.arabicfigure

        % just to allow 4 floats on a page:
        setcountertotalnumber4
        setcountertopnumber4

        begindocument

        % just for this example
        setcounterchapter2
        setcountersection3

        beginteoIn the beginning, dots endteo
        beginteoAfter a while, dotsendteo
        beginfigure[ht]captionFeeendfigure
        beginfigure[ht]captionFiendfigure
        beginfigure[ht]captionFoendfigure
        beginfigure[ht]captionFumendfigure
        beginexAnd then, dotsendex
        beginexFinally, dotsendex

        enddocument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 16 at 4:48









        MicoMico

        306k33 gold badges422 silver badges835 bronze badges




        306k33 gold badges422 silver badges835 bronze badges































            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%2f485068%2fhow-to-enumerate-figures-in-sync-with-another-counter%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

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?