How to enumerate figures in sync with another counter? Announcing the arrival of Valued...

Using et al. for a last / senior author rather than for a first author

List *all* the tuples!

How to react to hostile behavior from a senior developer?

When do you get frequent flier miles - when you buy, or when you fly?

Bete Noir -- no dairy

List of Python versions

Can an alien society believe that their star system is the universe?

How can I make names more distinctive without making them longer?

What does "fit" mean in this sentence?

Resolving to minmaj7

Why do we bend a book to keep it straight?

Why light coming from distant stars is not discreet?

What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?

What does this icon in iOS Stardew Valley mean?

Why aren't air breathing engines used as small first stages

Do I really need recursive chmod to restrict access to a folder?

Why am I getting the error "non-boolean type specified in a context where a condition is expected" for this request?

Apollo command module space walk?

What exactly is a "Meth" in Altered Carbon?

What is the role of the transistor and diode in a soft start circuit?

Is it fair for a professor to grade us on the possession of past papers?

What to do with chalk when deepwater soloing?

What's the meaning of 間時肆拾貳 at a car parking sign

What's the purpose of writing one's academic biography in the third person?



How to enumerate figures in sync with another counter?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Numbering figuresHow to make equations, figures and theorems use the same numbering schemeFigures on report counter page (without styling)Spacing issue in new environment from a theoremAdvanced hierarchical counting for theoremsHow can I set customized separators for theorem counters?Reset footnote counter by section with footmiscFigure/Tables/Equations… countersDifficulty with Subfig: Aligning Figures on CenterlineHow to show also the name of the parent counter with cleveref?How to organize text and figures












2















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



newtheorem{teo}{Theorem}[section]
newtheorem{ex}[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
    23 hours ago











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

    – Mico
    22 hours ago
















2















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



newtheorem{teo}{Theorem}[section]
newtheorem{ex}[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
    23 hours ago











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

    – Mico
    22 hours ago














2












2








2








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



newtheorem{teo}{Theorem}[section]
newtheorem{ex}[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:



newtheorem{teo}{Theorem}[section]
newtheorem{ex}[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 4 hours ago









Andrew

31.1k34482




31.1k34482










asked 23 hours ago









J.RodriguezJ.Rodriguez

2286




2286













  • 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
    23 hours ago











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

    – Mico
    22 hours ago



















  • 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
    23 hours ago











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

    – Mico
    22 hours ago

















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
23 hours ago





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
23 hours ago













Did you see this answer to the query Numbering figures?

– Mico
22 hours ago





Did you see this answer to the query Numbering figures?

– Mico
22 hours ago










2 Answers
2






active

oldest

votes


















5














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



numberwithin{figure}{section}% number figures inside sections
newtheorem{teo}[figure]{Theorem}
newtheorem{ex}[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:



documentclass{amsart}
numberwithin{figure}{section}
newtheorem{teo}[figure]{Theorem}
newtheorem{ex}[figure]{Example}

begin{document}

section{Let the section begin}

begin{teo}The sum of two numbers is a numberlabel{T:one}end{teo}

begin{figure}[h]A figurecaption{Nice one}label{F:one}end{figure}

begin{ex}For example, $1+2=3$.label{E:one}end{ex}

See ref{T:one}, ref{F:one} and ref{E:one}.

end{document}





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
    7 hours ago











  • @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@addtoreset{figure}{section}makeatother with the article document class.

    – Andrew
    5 hours ago











  • Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
    3 hours ago



















2














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



enter image description here



documentclass{report}

usepackage{amsthm}
newtheorem{teo}{Theorem}[section]
newtheorem{ex}[teo]{Example}

usepackage{xassoccnt}
DeclareCoupledCounters[name=figurteo]{figure,teo}
renewcommandthefigure{thesection.arabic{figure}}

% just to allow 4 floats on a page:
setcounter{totalnumber}{4}
setcounter{topnumber}{4}

begin{document}

% just for this example
setcounter{chapter}{2}
setcounter{section}{3}

begin{teo}In the beginning, dots end{teo}
begin{teo}After a while, dotsend{teo}
begin{figure}[ht]caption{Fee}end{figure}
begin{figure}[ht]caption{Fi}end{figure}
begin{figure}[ht]caption{Fo}end{figure}
begin{figure}[ht]caption{Fum}end{figure}
begin{ex}And then, dotsend{ex}
begin{ex}Finally, dotsend{ex}

end{document}





share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















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









    5














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



    numberwithin{figure}{section}% number figures inside sections
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[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:



    documentclass{amsart}
    numberwithin{figure}{section}
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[figure]{Example}

    begin{document}

    section{Let the section begin}

    begin{teo}The sum of two numbers is a numberlabel{T:one}end{teo}

    begin{figure}[h]A figurecaption{Nice one}label{F:one}end{figure}

    begin{ex}For example, $1+2=3$.label{E:one}end{ex}

    See ref{T:one}, ref{F:one} and ref{E:one}.

    end{document}





    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
      7 hours ago











    • @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@addtoreset{figure}{section}makeatother with the article document class.

      – Andrew
      5 hours ago











    • Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
      3 hours ago
















    5














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



    numberwithin{figure}{section}% number figures inside sections
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[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:



    documentclass{amsart}
    numberwithin{figure}{section}
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[figure]{Example}

    begin{document}

    section{Let the section begin}

    begin{teo}The sum of two numbers is a numberlabel{T:one}end{teo}

    begin{figure}[h]A figurecaption{Nice one}label{F:one}end{figure}

    begin{ex}For example, $1+2=3$.label{E:one}end{ex}

    See ref{T:one}, ref{F:one} and ref{E:one}.

    end{document}





    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
      7 hours ago











    • @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@addtoreset{figure}{section}makeatother with the article document class.

      – Andrew
      5 hours ago











    • Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
      3 hours ago














    5












    5








    5







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



    numberwithin{figure}{section}% number figures inside sections
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[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:



    documentclass{amsart}
    numberwithin{figure}{section}
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[figure]{Example}

    begin{document}

    section{Let the section begin}

    begin{teo}The sum of two numbers is a numberlabel{T:one}end{teo}

    begin{figure}[h]A figurecaption{Nice one}label{F:one}end{figure}

    begin{ex}For example, $1+2=3$.label{E:one}end{ex}

    See ref{T:one}, ref{F:one} and ref{E:one}.

    end{document}





    share|improve this answer















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



    numberwithin{figure}{section}% number figures inside sections
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[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:



    documentclass{amsart}
    numberwithin{figure}{section}
    newtheorem{teo}[figure]{Theorem}
    newtheorem{ex}[figure]{Example}

    begin{document}

    section{Let the section begin}

    begin{teo}The sum of two numbers is a numberlabel{T:one}end{teo}

    begin{figure}[h]A figurecaption{Nice one}label{F:one}end{figure}

    begin{ex}For example, $1+2=3$.label{E:one}end{ex}

    See ref{T:one}, ref{F:one} and ref{E:one}.

    end{document}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 22 hours ago

























    answered 22 hours ago









    AndrewAndrew

    31.1k34482




    31.1k34482













    • 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
      7 hours ago











    • @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@addtoreset{figure}{section}makeatother with the article document class.

      – Andrew
      5 hours ago











    • Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
      3 hours ago



















    • 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
      7 hours ago











    • @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@addtoreset{figure}{section}makeatother with the article document class.

      – Andrew
      5 hours ago











    • Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
      3 hours ago

















    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
    7 hours ago





    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
    7 hours ago













    @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@addtoreset{figure}{section}makeatother with the article document class.

    – Andrew
    5 hours ago





    @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@addtoreset{figure}{section}makeatother with the article document class.

    – Andrew
    5 hours ago













    Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
    3 hours ago





    Ah! Forgot that. Easily fixed -- usepackage{amsmath}. (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
    3 hours ago











    2














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



    enter image description here



    documentclass{report}

    usepackage{amsthm}
    newtheorem{teo}{Theorem}[section]
    newtheorem{ex}[teo]{Example}

    usepackage{xassoccnt}
    DeclareCoupledCounters[name=figurteo]{figure,teo}
    renewcommandthefigure{thesection.arabic{figure}}

    % just to allow 4 floats on a page:
    setcounter{totalnumber}{4}
    setcounter{topnumber}{4}

    begin{document}

    % just for this example
    setcounter{chapter}{2}
    setcounter{section}{3}

    begin{teo}In the beginning, dots end{teo}
    begin{teo}After a while, dotsend{teo}
    begin{figure}[ht]caption{Fee}end{figure}
    begin{figure}[ht]caption{Fi}end{figure}
    begin{figure}[ht]caption{Fo}end{figure}
    begin{figure}[ht]caption{Fum}end{figure}
    begin{ex}And then, dotsend{ex}
    begin{ex}Finally, dotsend{ex}

    end{document}





    share|improve this answer




























      2














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



      enter image description here



      documentclass{report}

      usepackage{amsthm}
      newtheorem{teo}{Theorem}[section]
      newtheorem{ex}[teo]{Example}

      usepackage{xassoccnt}
      DeclareCoupledCounters[name=figurteo]{figure,teo}
      renewcommandthefigure{thesection.arabic{figure}}

      % just to allow 4 floats on a page:
      setcounter{totalnumber}{4}
      setcounter{topnumber}{4}

      begin{document}

      % just for this example
      setcounter{chapter}{2}
      setcounter{section}{3}

      begin{teo}In the beginning, dots end{teo}
      begin{teo}After a while, dotsend{teo}
      begin{figure}[ht]caption{Fee}end{figure}
      begin{figure}[ht]caption{Fi}end{figure}
      begin{figure}[ht]caption{Fo}end{figure}
      begin{figure}[ht]caption{Fum}end{figure}
      begin{ex}And then, dotsend{ex}
      begin{ex}Finally, dotsend{ex}

      end{document}





      share|improve this answer


























        2












        2








        2







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



        enter image description here



        documentclass{report}

        usepackage{amsthm}
        newtheorem{teo}{Theorem}[section]
        newtheorem{ex}[teo]{Example}

        usepackage{xassoccnt}
        DeclareCoupledCounters[name=figurteo]{figure,teo}
        renewcommandthefigure{thesection.arabic{figure}}

        % just to allow 4 floats on a page:
        setcounter{totalnumber}{4}
        setcounter{topnumber}{4}

        begin{document}

        % just for this example
        setcounter{chapter}{2}
        setcounter{section}{3}

        begin{teo}In the beginning, dots end{teo}
        begin{teo}After a while, dotsend{teo}
        begin{figure}[ht]caption{Fee}end{figure}
        begin{figure}[ht]caption{Fi}end{figure}
        begin{figure}[ht]caption{Fo}end{figure}
        begin{figure}[ht]caption{Fum}end{figure}
        begin{ex}And then, dotsend{ex}
        begin{ex}Finally, dotsend{ex}

        end{document}





        share|improve this answer













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



        enter image description here



        documentclass{report}

        usepackage{amsthm}
        newtheorem{teo}{Theorem}[section]
        newtheorem{ex}[teo]{Example}

        usepackage{xassoccnt}
        DeclareCoupledCounters[name=figurteo]{figure,teo}
        renewcommandthefigure{thesection.arabic{figure}}

        % just to allow 4 floats on a page:
        setcounter{totalnumber}{4}
        setcounter{topnumber}{4}

        begin{document}

        % just for this example
        setcounter{chapter}{2}
        setcounter{section}{3}

        begin{teo}In the beginning, dots end{teo}
        begin{teo}After a while, dotsend{teo}
        begin{figure}[ht]caption{Fee}end{figure}
        begin{figure}[ht]caption{Fi}end{figure}
        begin{figure}[ht]caption{Fo}end{figure}
        begin{figure}[ht]caption{Fum}end{figure}
        begin{ex}And then, dotsend{ex}
        begin{ex}Finally, dotsend{ex}

        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 22 hours ago









        MicoMico

        287k32392781




        287k32392781






























            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

            Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...

            Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

            VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...