Table mislabeled as figure












1















I have an image and a table and they need to appear in the same page. The way I'm doing that right now is by wrapping them both in a figure. The problem I'm having is I'm trying to reference the table and LaTex keeps on labeling it as a figure.



documentclass[12pt]{article}
usepackage[margin=1in]{geometry}
usepackage[colorlinks]{hyperref}
usepackage[singlelinecheck=false]{caption}
usepackage{booktabs}
usepackage{threeparttable}
usepackage{graphicx}
graphicspath{ {./images/} }

begin{document}

stuff stuff autoref{table:nmr_nitro} blah blah.

begin{figure}
includegraphics[scale=0.4]{3-nitrobenzonitrile.png}
captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
label{figure:nmr_fig_nitro}

begin{threeparttable}
addtocounter{footnote}{1}
captionof{table}{NMR of 3-nitrobenzonitrile}
label{table:nmr_nitro}

begin{tabular}{ c c }
toprule
textbf{Some Data} & textbf{Assignment} \
midrule
8.542; 2.0 (2H); m; & A, B \
7.960; 2.1 (2H); m; & C, D \
bottomrule
end{tabular}
end{threeparttable}

end{figure}

end{document}


enter image description here



I found two solutions-ish to this problem. The first is to use manual instead of autoref and just manually label all my links. The other is to put captionsetup{type=table} above my table caption but this seems like a hack. Is there any builtin, smooth way to do this?










share|improve this question







New contributor




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

























    1















    I have an image and a table and they need to appear in the same page. The way I'm doing that right now is by wrapping them both in a figure. The problem I'm having is I'm trying to reference the table and LaTex keeps on labeling it as a figure.



    documentclass[12pt]{article}
    usepackage[margin=1in]{geometry}
    usepackage[colorlinks]{hyperref}
    usepackage[singlelinecheck=false]{caption}
    usepackage{booktabs}
    usepackage{threeparttable}
    usepackage{graphicx}
    graphicspath{ {./images/} }

    begin{document}

    stuff stuff autoref{table:nmr_nitro} blah blah.

    begin{figure}
    includegraphics[scale=0.4]{3-nitrobenzonitrile.png}
    captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
    label{figure:nmr_fig_nitro}

    begin{threeparttable}
    addtocounter{footnote}{1}
    captionof{table}{NMR of 3-nitrobenzonitrile}
    label{table:nmr_nitro}

    begin{tabular}{ c c }
    toprule
    textbf{Some Data} & textbf{Assignment} \
    midrule
    8.542; 2.0 (2H); m; & A, B \
    7.960; 2.1 (2H); m; & C, D \
    bottomrule
    end{tabular}
    end{threeparttable}

    end{figure}

    end{document}


    enter image description here



    I found two solutions-ish to this problem. The first is to use manual instead of autoref and just manually label all my links. The other is to put captionsetup{type=table} above my table caption but this seems like a hack. Is there any builtin, smooth way to do this?










    share|improve this question







    New contributor




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























      1












      1








      1








      I have an image and a table and they need to appear in the same page. The way I'm doing that right now is by wrapping them both in a figure. The problem I'm having is I'm trying to reference the table and LaTex keeps on labeling it as a figure.



      documentclass[12pt]{article}
      usepackage[margin=1in]{geometry}
      usepackage[colorlinks]{hyperref}
      usepackage[singlelinecheck=false]{caption}
      usepackage{booktabs}
      usepackage{threeparttable}
      usepackage{graphicx}
      graphicspath{ {./images/} }

      begin{document}

      stuff stuff autoref{table:nmr_nitro} blah blah.

      begin{figure}
      includegraphics[scale=0.4]{3-nitrobenzonitrile.png}
      captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
      label{figure:nmr_fig_nitro}

      begin{threeparttable}
      addtocounter{footnote}{1}
      captionof{table}{NMR of 3-nitrobenzonitrile}
      label{table:nmr_nitro}

      begin{tabular}{ c c }
      toprule
      textbf{Some Data} & textbf{Assignment} \
      midrule
      8.542; 2.0 (2H); m; & A, B \
      7.960; 2.1 (2H); m; & C, D \
      bottomrule
      end{tabular}
      end{threeparttable}

      end{figure}

      end{document}


      enter image description here



      I found two solutions-ish to this problem. The first is to use manual instead of autoref and just manually label all my links. The other is to put captionsetup{type=table} above my table caption but this seems like a hack. Is there any builtin, smooth way to do this?










      share|improve this question







      New contributor




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












      I have an image and a table and they need to appear in the same page. The way I'm doing that right now is by wrapping them both in a figure. The problem I'm having is I'm trying to reference the table and LaTex keeps on labeling it as a figure.



      documentclass[12pt]{article}
      usepackage[margin=1in]{geometry}
      usepackage[colorlinks]{hyperref}
      usepackage[singlelinecheck=false]{caption}
      usepackage{booktabs}
      usepackage{threeparttable}
      usepackage{graphicx}
      graphicspath{ {./images/} }

      begin{document}

      stuff stuff autoref{table:nmr_nitro} blah blah.

      begin{figure}
      includegraphics[scale=0.4]{3-nitrobenzonitrile.png}
      captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
      label{figure:nmr_fig_nitro}

      begin{threeparttable}
      addtocounter{footnote}{1}
      captionof{table}{NMR of 3-nitrobenzonitrile}
      label{table:nmr_nitro}

      begin{tabular}{ c c }
      toprule
      textbf{Some Data} & textbf{Assignment} \
      midrule
      8.542; 2.0 (2H); m; & A, B \
      7.960; 2.1 (2H); m; & C, D \
      bottomrule
      end{tabular}
      end{threeparttable}

      end{figure}

      end{document}


      enter image description here



      I found two solutions-ish to this problem. The first is to use manual instead of autoref and just manually label all my links. The other is to put captionsetup{type=table} above my table caption but this seems like a hack. Is there any builtin, smooth way to do this?







      tables hyperref captions ref autoref






      share|improve this question







      New contributor




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











      share|improve this question







      New contributor




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









      share|improve this question




      share|improve this question






      New contributor




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









      asked 2 hours ago









      FailureGodFailureGod

      252




      252




      New contributor




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





      New contributor





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






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






















          2 Answers
          2






          active

          oldest

          votes


















          0














          I think an easier solution would be to change caption to capt-of:



          From:



          usepackage[singlelinecheck=false]{caption}


          To:



          usepackage{capt-of}





          share|improve this answer































            3














            This is because you put the table in a figure environment. Since you are already using the caption package, you may e.g. do



            documentclass[12pt]{article}
            usepackage[margin=1in]{geometry}
            usepackage[colorlinks]{hyperref}
            usepackage[singlelinecheck=false]{caption}
            usepackage{booktabs}
            usepackage{threeparttable}
            usepackage{graphicx}
            graphicspath{ {./images/} }

            begin{document}

            stuff stuff autoref{table:nmr_nitro} blah blah.

            noindent
            begin{minipage}{textwidth}
            centering
            includegraphics[scale=0.4]{example-image-a}
            captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
            label{figure:nmr_fig_nitro}


            addtocounter{footnote}{1}
            captionof{table}{NMR of 3-nitrobenzonitrile}
            label{table:nmr_nitro}
            begin{threeparttable}

            begin{tabular}{ c c }
            toprule
            textbf{Some Data} & textbf{Assignment} \
            midrule
            8.542; 2.0 (2H); m; & A, B \
            7.960; 2.1 (2H); m; & C, D \
            bottomrule
            end{tabular}
            end{threeparttable}
            end{minipage}


            end{document}


            enter image description here






            share|improve this answer


























            • This doesnt work because I need the image and the table to be guaranteed to be on the same page.

              – FailureGod
              1 hour ago













            • @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

              – marmot
              1 hour ago











            • @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

              – marmot
              1 hour ago











            • I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

              – FailureGod
              1 hour ago











            • @FailureGod I added something of that sort.

              – marmot
              1 hour ago












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


            }
            });






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










            draft saved

            draft discarded


















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









            0














            I think an easier solution would be to change caption to capt-of:



            From:



            usepackage[singlelinecheck=false]{caption}


            To:



            usepackage{capt-of}





            share|improve this answer




























              0














              I think an easier solution would be to change caption to capt-of:



              From:



              usepackage[singlelinecheck=false]{caption}


              To:



              usepackage{capt-of}





              share|improve this answer


























                0












                0








                0







                I think an easier solution would be to change caption to capt-of:



                From:



                usepackage[singlelinecheck=false]{caption}


                To:



                usepackage{capt-of}





                share|improve this answer













                I think an easier solution would be to change caption to capt-of:



                From:



                usepackage[singlelinecheck=false]{caption}


                To:



                usepackage{capt-of}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 hours ago









                Guilherme SilvaGuilherme Silva

                184




                184























                    3














                    This is because you put the table in a figure environment. Since you are already using the caption package, you may e.g. do



                    documentclass[12pt]{article}
                    usepackage[margin=1in]{geometry}
                    usepackage[colorlinks]{hyperref}
                    usepackage[singlelinecheck=false]{caption}
                    usepackage{booktabs}
                    usepackage{threeparttable}
                    usepackage{graphicx}
                    graphicspath{ {./images/} }

                    begin{document}

                    stuff stuff autoref{table:nmr_nitro} blah blah.

                    noindent
                    begin{minipage}{textwidth}
                    centering
                    includegraphics[scale=0.4]{example-image-a}
                    captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
                    label{figure:nmr_fig_nitro}


                    addtocounter{footnote}{1}
                    captionof{table}{NMR of 3-nitrobenzonitrile}
                    label{table:nmr_nitro}
                    begin{threeparttable}

                    begin{tabular}{ c c }
                    toprule
                    textbf{Some Data} & textbf{Assignment} \
                    midrule
                    8.542; 2.0 (2H); m; & A, B \
                    7.960; 2.1 (2H); m; & C, D \
                    bottomrule
                    end{tabular}
                    end{threeparttable}
                    end{minipage}


                    end{document}


                    enter image description here






                    share|improve this answer


























                    • This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                      – FailureGod
                      1 hour ago













                    • @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                      – marmot
                      1 hour ago











                    • @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                      – marmot
                      1 hour ago











                    • I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                      – FailureGod
                      1 hour ago











                    • @FailureGod I added something of that sort.

                      – marmot
                      1 hour ago
















                    3














                    This is because you put the table in a figure environment. Since you are already using the caption package, you may e.g. do



                    documentclass[12pt]{article}
                    usepackage[margin=1in]{geometry}
                    usepackage[colorlinks]{hyperref}
                    usepackage[singlelinecheck=false]{caption}
                    usepackage{booktabs}
                    usepackage{threeparttable}
                    usepackage{graphicx}
                    graphicspath{ {./images/} }

                    begin{document}

                    stuff stuff autoref{table:nmr_nitro} blah blah.

                    noindent
                    begin{minipage}{textwidth}
                    centering
                    includegraphics[scale=0.4]{example-image-a}
                    captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
                    label{figure:nmr_fig_nitro}


                    addtocounter{footnote}{1}
                    captionof{table}{NMR of 3-nitrobenzonitrile}
                    label{table:nmr_nitro}
                    begin{threeparttable}

                    begin{tabular}{ c c }
                    toprule
                    textbf{Some Data} & textbf{Assignment} \
                    midrule
                    8.542; 2.0 (2H); m; & A, B \
                    7.960; 2.1 (2H); m; & C, D \
                    bottomrule
                    end{tabular}
                    end{threeparttable}
                    end{minipage}


                    end{document}


                    enter image description here






                    share|improve this answer


























                    • This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                      – FailureGod
                      1 hour ago













                    • @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                      – marmot
                      1 hour ago











                    • @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                      – marmot
                      1 hour ago











                    • I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                      – FailureGod
                      1 hour ago











                    • @FailureGod I added something of that sort.

                      – marmot
                      1 hour ago














                    3












                    3








                    3







                    This is because you put the table in a figure environment. Since you are already using the caption package, you may e.g. do



                    documentclass[12pt]{article}
                    usepackage[margin=1in]{geometry}
                    usepackage[colorlinks]{hyperref}
                    usepackage[singlelinecheck=false]{caption}
                    usepackage{booktabs}
                    usepackage{threeparttable}
                    usepackage{graphicx}
                    graphicspath{ {./images/} }

                    begin{document}

                    stuff stuff autoref{table:nmr_nitro} blah blah.

                    noindent
                    begin{minipage}{textwidth}
                    centering
                    includegraphics[scale=0.4]{example-image-a}
                    captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
                    label{figure:nmr_fig_nitro}


                    addtocounter{footnote}{1}
                    captionof{table}{NMR of 3-nitrobenzonitrile}
                    label{table:nmr_nitro}
                    begin{threeparttable}

                    begin{tabular}{ c c }
                    toprule
                    textbf{Some Data} & textbf{Assignment} \
                    midrule
                    8.542; 2.0 (2H); m; & A, B \
                    7.960; 2.1 (2H); m; & C, D \
                    bottomrule
                    end{tabular}
                    end{threeparttable}
                    end{minipage}


                    end{document}


                    enter image description here






                    share|improve this answer















                    This is because you put the table in a figure environment. Since you are already using the caption package, you may e.g. do



                    documentclass[12pt]{article}
                    usepackage[margin=1in]{geometry}
                    usepackage[colorlinks]{hyperref}
                    usepackage[singlelinecheck=false]{caption}
                    usepackage{booktabs}
                    usepackage{threeparttable}
                    usepackage{graphicx}
                    graphicspath{ {./images/} }

                    begin{document}

                    stuff stuff autoref{table:nmr_nitro} blah blah.

                    noindent
                    begin{minipage}{textwidth}
                    centering
                    includegraphics[scale=0.4]{example-image-a}
                    captionof{figure}{3-Nitrobenzonitrile with hydrogens assignments}
                    label{figure:nmr_fig_nitro}


                    addtocounter{footnote}{1}
                    captionof{table}{NMR of 3-nitrobenzonitrile}
                    label{table:nmr_nitro}
                    begin{threeparttable}

                    begin{tabular}{ c c }
                    toprule
                    textbf{Some Data} & textbf{Assignment} \
                    midrule
                    8.542; 2.0 (2H); m; & A, B \
                    7.960; 2.1 (2H); m; & C, D \
                    bottomrule
                    end{tabular}
                    end{threeparttable}
                    end{minipage}


                    end{document}


                    enter image description here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 1 hour ago

























                    answered 2 hours ago









                    marmotmarmot

                    114k5145276




                    114k5145276













                    • This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                      – FailureGod
                      1 hour ago













                    • @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                      – marmot
                      1 hour ago











                    • @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                      – marmot
                      1 hour ago











                    • I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                      – FailureGod
                      1 hour ago











                    • @FailureGod I added something of that sort.

                      – marmot
                      1 hour ago



















                    • This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                      – FailureGod
                      1 hour ago













                    • @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                      – marmot
                      1 hour ago











                    • @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                      – marmot
                      1 hour ago











                    • I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                      – FailureGod
                      1 hour ago











                    • @FailureGod I added something of that sort.

                      – marmot
                      1 hour ago

















                    This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                    – FailureGod
                    1 hour ago







                    This doesnt work because I need the image and the table to be guaranteed to be on the same page.

                    – FailureGod
                    1 hour ago















                    @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                    – marmot
                    1 hour ago





                    @FailureGod You can certainly make them appear on one side. The question is if you want them to float or be fixed at a given page.

                    – marmot
                    1 hour ago













                    @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                    – marmot
                    1 hour ago





                    @FailureGod The you could for instance wrap them in a minipage or in a tabular, depending on your layout preferences.

                    – marmot
                    1 hour ago













                    I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                    – FailureGod
                    1 hour ago





                    I need them to appear at a specific place in text. Like ''' Some text <image and figure> more text ''' where the image and the figure are not broken by a pagebreak.

                    – FailureGod
                    1 hour ago













                    @FailureGod I added something of that sort.

                    – marmot
                    1 hour ago





                    @FailureGod I added something of that sort.

                    – marmot
                    1 hour ago










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










                    draft saved

                    draft discarded


















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













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












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
















                    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%2f483087%2ftable-mislabeled-as-figure%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

                    Bundesstraße 106

                    Verónica Boquete

                    Ida-Boy-Ed-Garten