Remove figures, but keep references to image

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite












I want to remove a figure and its caption from a LaTeX file, but I want to keep the references to it in the text.



So far I kept the empty figure environment with a caption and a label. The problem is, I can not make the caption vanish without destroying the references.



I tried caption* as well as



setbox0=vboxcaptionsomecaption


as was suggested here.



However, as soon as the caption "Fig. 1" disappears, also my reference to the label disappears.



documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
usepackagegraphicx
begindocument

I want to reference Fig.~reffig1. \

beginfigure
%includegraphicsimage.pdf
caption
labelfig1
endfigure

enddocument


It would be nice if someone could help me, as I didn't find anything about this myself.










share|improve this question























  • Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
    – NBur
    Sep 28 at 7:40










  • The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
    – Skillmon
    Sep 28 at 7:46










  • Also: Do you want the caption be listed in the list of figures?
    – Skillmon
    Sep 28 at 7:46










  • @Nbur exactly :-)
    – Mechanix
    Sep 28 at 7:50










  • @Skillmon the list of figures doesn't matter to me
    – Mechanix
    Sep 28 at 7:58














up vote
4
down vote

favorite












I want to remove a figure and its caption from a LaTeX file, but I want to keep the references to it in the text.



So far I kept the empty figure environment with a caption and a label. The problem is, I can not make the caption vanish without destroying the references.



I tried caption* as well as



setbox0=vboxcaptionsomecaption


as was suggested here.



However, as soon as the caption "Fig. 1" disappears, also my reference to the label disappears.



documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
usepackagegraphicx
begindocument

I want to reference Fig.~reffig1. \

beginfigure
%includegraphicsimage.pdf
caption
labelfig1
endfigure

enddocument


It would be nice if someone could help me, as I didn't find anything about this myself.










share|improve this question























  • Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
    – NBur
    Sep 28 at 7:40










  • The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
    – Skillmon
    Sep 28 at 7:46










  • Also: Do you want the caption be listed in the list of figures?
    – Skillmon
    Sep 28 at 7:46










  • @Nbur exactly :-)
    – Mechanix
    Sep 28 at 7:50










  • @Skillmon the list of figures doesn't matter to me
    – Mechanix
    Sep 28 at 7:58












up vote
4
down vote

favorite









up vote
4
down vote

favorite











I want to remove a figure and its caption from a LaTeX file, but I want to keep the references to it in the text.



So far I kept the empty figure environment with a caption and a label. The problem is, I can not make the caption vanish without destroying the references.



I tried caption* as well as



setbox0=vboxcaptionsomecaption


as was suggested here.



However, as soon as the caption "Fig. 1" disappears, also my reference to the label disappears.



documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
usepackagegraphicx
begindocument

I want to reference Fig.~reffig1. \

beginfigure
%includegraphicsimage.pdf
caption
labelfig1
endfigure

enddocument


It would be nice if someone could help me, as I didn't find anything about this myself.










share|improve this question















I want to remove a figure and its caption from a LaTeX file, but I want to keep the references to it in the text.



So far I kept the empty figure environment with a caption and a label. The problem is, I can not make the caption vanish without destroying the references.



I tried caption* as well as



setbox0=vboxcaptionsomecaption


as was suggested here.



However, as soon as the caption "Fig. 1" disappears, also my reference to the label disappears.



documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
usepackagegraphicx
begindocument

I want to reference Fig.~reffig1. \

beginfigure
%includegraphicsimage.pdf
caption
labelfig1
endfigure

enddocument


It would be nice if someone could help me, as I didn't find anything about this myself.







cross-referencing captions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 28 at 11:20









Phelype Oleinik

17.5k43771




17.5k43771










asked Sep 28 at 7:14









Mechanix

434




434











  • Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
    – NBur
    Sep 28 at 7:40










  • The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
    – Skillmon
    Sep 28 at 7:46










  • Also: Do you want the caption be listed in the list of figures?
    – Skillmon
    Sep 28 at 7:46










  • @Nbur exactly :-)
    – Mechanix
    Sep 28 at 7:50










  • @Skillmon the list of figures doesn't matter to me
    – Mechanix
    Sep 28 at 7:58
















  • Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
    – NBur
    Sep 28 at 7:40










  • The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
    – Skillmon
    Sep 28 at 7:46










  • Also: Do you want the caption be listed in the list of figures?
    – Skillmon
    Sep 28 at 7:46










  • @Nbur exactly :-)
    – Mechanix
    Sep 28 at 7:50










  • @Skillmon the list of figures doesn't matter to me
    – Mechanix
    Sep 28 at 7:58















Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
Sep 28 at 7:40




Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
Sep 28 at 7:40












The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
– Skillmon
Sep 28 at 7:46




The labelling in this case is a bit hard to do right reliably. The problem is that the label will only get written to the aux if the box it is used in is typeset. This is done so that the reference will lead to the correct page if it floats.
– Skillmon
Sep 28 at 7:46












Also: Do you want the caption be listed in the list of figures?
– Skillmon
Sep 28 at 7:46




Also: Do you want the caption be listed in the list of figures?
– Skillmon
Sep 28 at 7:46












@Nbur exactly :-)
– Mechanix
Sep 28 at 7:50




@Nbur exactly :-)
– Mechanix
Sep 28 at 7:50












@Skillmon the list of figures doesn't matter to me
– Mechanix
Sep 28 at 7:58




@Skillmon the list of figures doesn't matter to me
– Mechanix
Sep 28 at 7:58










3 Answers
3






active

oldest

votes

















up vote
8
down vote



accepted










documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
usepackagegraphicx
begindocument

I want to reference Fig.~reffig1. % never use \ at end of paragraph


refstepcounterfigurelabelfig1


enddocument





share|improve this answer




















  • Awesome! That does the trick! Thanks a lot!
    – Mechanix
    Sep 28 at 8:00

















up vote
4
down vote













Possible solutions I can think of currently:



You could move the caption out of the page and smash it so it does have no height. The space occupied by the figure environment would still be taken but you'd still use the floating mechanism of LaTeX so that your reference would point to the correct page and you won't have to deal with correct numbering. This could be done with:



newcommandcaptionaway[1]
%
setbox0hboxvbox#1%
null
hspace*2paperwidth%
smashusebox0%



Then you'd place your caption and the label command in the argument of captionaway. The caption would still show up in the list of figures.



Another possible solution is to only refstepcounter the figure counter and place a label. E.g. with:



makeatletter
newcommandonlylabel[2][@captype]
refstepcounter#1label#2
makeatother


This would give you a macro onlylabel which, when used inside of a float (so figure or table) would place a label without a caption. If you use it outside of a float you could use it like onlylabel[figure]fig:label. If you use it outside of a float you'd have to watch out that you place it at the correct location if you have other floats of the same kind. Best would be to place it at the end of the previous float, to get numbering right (because if it were a float it would have been on the float stack for at least as long as the previous float isn't shipped).



Complete MWE using both methods:



documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]
revtex4-1
usepackagegraphicx

newcommandcaptionaway[1]
%
setbox0hboxvbox#1%
null
hspace*2paperwidth%
smashusebox0%

makeatletter
newcommandonlylabel[2][@captype]
refstepcounter#1label#2
makeatother

begindocument

I want to reference Fig.~reffig1. \

beginfigure
%includegraphicsimage.pdf
captionaway
%
captionThis caption%
labelfig1%
%
onlylabelfig:hidden
endfigure

I also reference Fig.~reffig:hidden. Note that Fig.~reffig1 does use some
space as the textttfigure environment was actually used and needs some space.

enddocument





share|improve this answer



























    up vote
    3
    down vote













    I made a command so that just adding a star you can switch.



    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
    usepackagegraphicx
    usepackagecleveref
    usepackagexparse
    NewDocumentCommandmyFigsmmm%
    IfBooleanTF#1%
    refstepcounterfigurelabel#4
    beginfigure
    #2
    caption#3
    label#4
    endfigure


    begindocument

    I want to reference Fig.~reflabel1, creflabel2.

    myFigincludegraphics[width=linewidth]example-image-a.pdfCaption1label1
    myFig*includegraphicsexample-image-a.pdfCaption2label2
    enddocument





    share|improve this answer




















    • Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
      – Skillmon
      Sep 28 at 8:01










    • @Skillmon good point, haven't thought of it…
      – NBur
      Sep 28 at 8:06










    • thanks a lot! Now i have more solutions than problems :-)
      – Mechanix
      Sep 28 at 8:31










    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f452887%2fremove-figures-but-keep-references-to-image%23new-answer', 'question_page');

    );

    Post as a guest






























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    8
    down vote



    accepted










    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
    usepackagegraphicx
    begindocument

    I want to reference Fig.~reffig1. % never use \ at end of paragraph


    refstepcounterfigurelabelfig1


    enddocument





    share|improve this answer




















    • Awesome! That does the trick! Thanks a lot!
      – Mechanix
      Sep 28 at 8:00














    up vote
    8
    down vote



    accepted










    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
    usepackagegraphicx
    begindocument

    I want to reference Fig.~reffig1. % never use \ at end of paragraph


    refstepcounterfigurelabelfig1


    enddocument





    share|improve this answer




















    • Awesome! That does the trick! Thanks a lot!
      – Mechanix
      Sep 28 at 8:00












    up vote
    8
    down vote



    accepted







    up vote
    8
    down vote



    accepted






    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
    usepackagegraphicx
    begindocument

    I want to reference Fig.~reffig1. % never use \ at end of paragraph


    refstepcounterfigurelabelfig1


    enddocument





    share|improve this answer












    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
    usepackagegraphicx
    begindocument

    I want to reference Fig.~reffig1. % never use \ at end of paragraph


    refstepcounterfigurelabelfig1


    enddocument






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 28 at 7:50









    David Carlisle

    470k3810991827




    470k3810991827











    • Awesome! That does the trick! Thanks a lot!
      – Mechanix
      Sep 28 at 8:00
















    • Awesome! That does the trick! Thanks a lot!
      – Mechanix
      Sep 28 at 8:00















    Awesome! That does the trick! Thanks a lot!
    – Mechanix
    Sep 28 at 8:00




    Awesome! That does the trick! Thanks a lot!
    – Mechanix
    Sep 28 at 8:00










    up vote
    4
    down vote













    Possible solutions I can think of currently:



    You could move the caption out of the page and smash it so it does have no height. The space occupied by the figure environment would still be taken but you'd still use the floating mechanism of LaTeX so that your reference would point to the correct page and you won't have to deal with correct numbering. This could be done with:



    newcommandcaptionaway[1]
    %
    setbox0hboxvbox#1%
    null
    hspace*2paperwidth%
    smashusebox0%



    Then you'd place your caption and the label command in the argument of captionaway. The caption would still show up in the list of figures.



    Another possible solution is to only refstepcounter the figure counter and place a label. E.g. with:



    makeatletter
    newcommandonlylabel[2][@captype]
    refstepcounter#1label#2
    makeatother


    This would give you a macro onlylabel which, when used inside of a float (so figure or table) would place a label without a caption. If you use it outside of a float you could use it like onlylabel[figure]fig:label. If you use it outside of a float you'd have to watch out that you place it at the correct location if you have other floats of the same kind. Best would be to place it at the end of the previous float, to get numbering right (because if it were a float it would have been on the float stack for at least as long as the previous float isn't shipped).



    Complete MWE using both methods:



    documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]
    revtex4-1
    usepackagegraphicx

    newcommandcaptionaway[1]
    %
    setbox0hboxvbox#1%
    null
    hspace*2paperwidth%
    smashusebox0%

    makeatletter
    newcommandonlylabel[2][@captype]
    refstepcounter#1label#2
    makeatother

    begindocument

    I want to reference Fig.~reffig1. \

    beginfigure
    %includegraphicsimage.pdf
    captionaway
    %
    captionThis caption%
    labelfig1%
    %
    onlylabelfig:hidden
    endfigure

    I also reference Fig.~reffig:hidden. Note that Fig.~reffig1 does use some
    space as the textttfigure environment was actually used and needs some space.

    enddocument





    share|improve this answer
























      up vote
      4
      down vote













      Possible solutions I can think of currently:



      You could move the caption out of the page and smash it so it does have no height. The space occupied by the figure environment would still be taken but you'd still use the floating mechanism of LaTeX so that your reference would point to the correct page and you won't have to deal with correct numbering. This could be done with:



      newcommandcaptionaway[1]
      %
      setbox0hboxvbox#1%
      null
      hspace*2paperwidth%
      smashusebox0%



      Then you'd place your caption and the label command in the argument of captionaway. The caption would still show up in the list of figures.



      Another possible solution is to only refstepcounter the figure counter and place a label. E.g. with:



      makeatletter
      newcommandonlylabel[2][@captype]
      refstepcounter#1label#2
      makeatother


      This would give you a macro onlylabel which, when used inside of a float (so figure or table) would place a label without a caption. If you use it outside of a float you could use it like onlylabel[figure]fig:label. If you use it outside of a float you'd have to watch out that you place it at the correct location if you have other floats of the same kind. Best would be to place it at the end of the previous float, to get numbering right (because if it were a float it would have been on the float stack for at least as long as the previous float isn't shipped).



      Complete MWE using both methods:



      documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]
      revtex4-1
      usepackagegraphicx

      newcommandcaptionaway[1]
      %
      setbox0hboxvbox#1%
      null
      hspace*2paperwidth%
      smashusebox0%

      makeatletter
      newcommandonlylabel[2][@captype]
      refstepcounter#1label#2
      makeatother

      begindocument

      I want to reference Fig.~reffig1. \

      beginfigure
      %includegraphicsimage.pdf
      captionaway
      %
      captionThis caption%
      labelfig1%
      %
      onlylabelfig:hidden
      endfigure

      I also reference Fig.~reffig:hidden. Note that Fig.~reffig1 does use some
      space as the textttfigure environment was actually used and needs some space.

      enddocument





      share|improve this answer






















        up vote
        4
        down vote










        up vote
        4
        down vote









        Possible solutions I can think of currently:



        You could move the caption out of the page and smash it so it does have no height. The space occupied by the figure environment would still be taken but you'd still use the floating mechanism of LaTeX so that your reference would point to the correct page and you won't have to deal with correct numbering. This could be done with:



        newcommandcaptionaway[1]
        %
        setbox0hboxvbox#1%
        null
        hspace*2paperwidth%
        smashusebox0%



        Then you'd place your caption and the label command in the argument of captionaway. The caption would still show up in the list of figures.



        Another possible solution is to only refstepcounter the figure counter and place a label. E.g. with:



        makeatletter
        newcommandonlylabel[2][@captype]
        refstepcounter#1label#2
        makeatother


        This would give you a macro onlylabel which, when used inside of a float (so figure or table) would place a label without a caption. If you use it outside of a float you could use it like onlylabel[figure]fig:label. If you use it outside of a float you'd have to watch out that you place it at the correct location if you have other floats of the same kind. Best would be to place it at the end of the previous float, to get numbering right (because if it were a float it would have been on the float stack for at least as long as the previous float isn't shipped).



        Complete MWE using both methods:



        documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]
        revtex4-1
        usepackagegraphicx

        newcommandcaptionaway[1]
        %
        setbox0hboxvbox#1%
        null
        hspace*2paperwidth%
        smashusebox0%

        makeatletter
        newcommandonlylabel[2][@captype]
        refstepcounter#1label#2
        makeatother

        begindocument

        I want to reference Fig.~reffig1. \

        beginfigure
        %includegraphicsimage.pdf
        captionaway
        %
        captionThis caption%
        labelfig1%
        %
        onlylabelfig:hidden
        endfigure

        I also reference Fig.~reffig:hidden. Note that Fig.~reffig1 does use some
        space as the textttfigure environment was actually used and needs some space.

        enddocument





        share|improve this answer












        Possible solutions I can think of currently:



        You could move the caption out of the page and smash it so it does have no height. The space occupied by the figure environment would still be taken but you'd still use the floating mechanism of LaTeX so that your reference would point to the correct page and you won't have to deal with correct numbering. This could be done with:



        newcommandcaptionaway[1]
        %
        setbox0hboxvbox#1%
        null
        hspace*2paperwidth%
        smashusebox0%



        Then you'd place your caption and the label command in the argument of captionaway. The caption would still show up in the list of figures.



        Another possible solution is to only refstepcounter the figure counter and place a label. E.g. with:



        makeatletter
        newcommandonlylabel[2][@captype]
        refstepcounter#1label#2
        makeatother


        This would give you a macro onlylabel which, when used inside of a float (so figure or table) would place a label without a caption. If you use it outside of a float you could use it like onlylabel[figure]fig:label. If you use it outside of a float you'd have to watch out that you place it at the correct location if you have other floats of the same kind. Best would be to place it at the end of the previous float, to get numbering right (because if it were a float it would have been on the float stack for at least as long as the previous float isn't shipped).



        Complete MWE using both methods:



        documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]
        revtex4-1
        usepackagegraphicx

        newcommandcaptionaway[1]
        %
        setbox0hboxvbox#1%
        null
        hspace*2paperwidth%
        smashusebox0%

        makeatletter
        newcommandonlylabel[2][@captype]
        refstepcounter#1label#2
        makeatother

        begindocument

        I want to reference Fig.~reffig1. \

        beginfigure
        %includegraphicsimage.pdf
        captionaway
        %
        captionThis caption%
        labelfig1%
        %
        onlylabelfig:hidden
        endfigure

        I also reference Fig.~reffig:hidden. Note that Fig.~reffig1 does use some
        space as the textttfigure environment was actually used and needs some space.

        enddocument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 28 at 7:54









        Skillmon

        19k11637




        19k11637




















            up vote
            3
            down vote













            I made a command so that just adding a star you can switch.



            documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
            usepackagegraphicx
            usepackagecleveref
            usepackagexparse
            NewDocumentCommandmyFigsmmm%
            IfBooleanTF#1%
            refstepcounterfigurelabel#4
            beginfigure
            #2
            caption#3
            label#4
            endfigure


            begindocument

            I want to reference Fig.~reflabel1, creflabel2.

            myFigincludegraphics[width=linewidth]example-image-a.pdfCaption1label1
            myFig*includegraphicsexample-image-a.pdfCaption2label2
            enddocument





            share|improve this answer




















            • Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
              – Skillmon
              Sep 28 at 8:01










            • @Skillmon good point, haven't thought of it…
              – NBur
              Sep 28 at 8:06










            • thanks a lot! Now i have more solutions than problems :-)
              – Mechanix
              Sep 28 at 8:31














            up vote
            3
            down vote













            I made a command so that just adding a star you can switch.



            documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
            usepackagegraphicx
            usepackagecleveref
            usepackagexparse
            NewDocumentCommandmyFigsmmm%
            IfBooleanTF#1%
            refstepcounterfigurelabel#4
            beginfigure
            #2
            caption#3
            label#4
            endfigure


            begindocument

            I want to reference Fig.~reflabel1, creflabel2.

            myFigincludegraphics[width=linewidth]example-image-a.pdfCaption1label1
            myFig*includegraphicsexample-image-a.pdfCaption2label2
            enddocument





            share|improve this answer




















            • Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
              – Skillmon
              Sep 28 at 8:01










            • @Skillmon good point, haven't thought of it…
              – NBur
              Sep 28 at 8:06










            • thanks a lot! Now i have more solutions than problems :-)
              – Mechanix
              Sep 28 at 8:31












            up vote
            3
            down vote










            up vote
            3
            down vote









            I made a command so that just adding a star you can switch.



            documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
            usepackagegraphicx
            usepackagecleveref
            usepackagexparse
            NewDocumentCommandmyFigsmmm%
            IfBooleanTF#1%
            refstepcounterfigurelabel#4
            beginfigure
            #2
            caption#3
            label#4
            endfigure


            begindocument

            I want to reference Fig.~reflabel1, creflabel2.

            myFigincludegraphics[width=linewidth]example-image-a.pdfCaption1label1
            myFig*includegraphicsexample-image-a.pdfCaption2label2
            enddocument





            share|improve this answer












            I made a command so that just adding a star you can switch.



            documentclass[superscriptaddress,reprint,amsmath,amssymb,aps,floatfix]revtex4-1
            usepackagegraphicx
            usepackagecleveref
            usepackagexparse
            NewDocumentCommandmyFigsmmm%
            IfBooleanTF#1%
            refstepcounterfigurelabel#4
            beginfigure
            #2
            caption#3
            label#4
            endfigure


            begindocument

            I want to reference Fig.~reflabel1, creflabel2.

            myFigincludegraphics[width=linewidth]example-image-a.pdfCaption1label1
            myFig*includegraphicsexample-image-a.pdfCaption2label2
            enddocument






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Sep 28 at 7:59









            NBur

            1,07812




            1,07812











            • Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
              – Skillmon
              Sep 28 at 8:01










            • @Skillmon good point, haven't thought of it…
              – NBur
              Sep 28 at 8:06










            • thanks a lot! Now i have more solutions than problems :-)
              – Mechanix
              Sep 28 at 8:31
















            • Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
              – Skillmon
              Sep 28 at 8:01










            • @Skillmon good point, haven't thought of it…
              – NBur
              Sep 28 at 8:06










            • thanks a lot! Now i have more solutions than problems :-)
              – Mechanix
              Sep 28 at 8:31















            Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
            – Skillmon
            Sep 28 at 8:01




            Problems would occur if there was another float of the same kind prior to it that is moved to the next page, then you'd get incorrect numbers with this approach (the figure being placed later in the sources gets the smaller number). Also you should test for an empty fourth argument if one doesn't want a label, imho.
            – Skillmon
            Sep 28 at 8:01












            @Skillmon good point, haven't thought of it…
            – NBur
            Sep 28 at 8:06




            @Skillmon good point, haven't thought of it…
            – NBur
            Sep 28 at 8:06












            thanks a lot! Now i have more solutions than problems :-)
            – Mechanix
            Sep 28 at 8:31




            thanks a lot! Now i have more solutions than problems :-)
            – Mechanix
            Sep 28 at 8:31

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f452887%2fremove-figures-but-keep-references-to-image%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay