Remove figures, but keep references to image
Clash Royale CLAN TAG#URR8PPP
up vote
1
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.
captions ref
add a comment |Â
up vote
1
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.
captions ref
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
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
23 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
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.
captions ref
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.
captions ref
captions ref
asked 54 mins ago
Mechanix
284
284
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
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
23 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago
add a comment |Â
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
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
23 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
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
23 mins ago
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
23 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
3
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
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
add a comment |Â
up vote
2
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
add a comment |Â
up vote
1
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
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 alabel
, imho.
– Skillmon
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
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
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
add a comment |Â
up vote
3
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
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
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
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
answered 19 mins ago
David Carlisle
468k3810971822
468k3810971822
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
add a comment |Â
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
Awesome! That does the trick! Thanks a lot!
– Mechanix
9 mins ago
add a comment |Â
up vote
2
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
add a comment |Â
up vote
2
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
add a comment |Â
up vote
2
down vote
up vote
2
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
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
answered 14 mins ago


Skillmon
18.5k11637
18.5k11637
add a comment |Â
add a comment |Â
up vote
1
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
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 alabel
, imho.
– Skillmon
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
add a comment |Â
up vote
1
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
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 alabel
, imho.
– Skillmon
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
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
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
answered 10 mins ago
NBur
82311
82311
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 alabel
, imho.
– Skillmon
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
add a comment |Â
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 alabel
, imho.
– Skillmon
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
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
8 mins ago
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
8 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
@Skillmon good point, haven't thought of it…
– NBur
2 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Just to be clear: you don't want the picture nor its caption but do want be able to use reference to it?
– NBur
29 mins ago
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
23 mins ago
Also: Do you want the caption be listed in the list of figures?
– Skillmon
22 mins ago
@Nbur exactly :-)
– Mechanix
18 mins ago
@Skillmon the list of figures doesn't matter to me
– Mechanix
10 mins ago