TeX - LaTeX Asked by Rikki-Tikki-Tavi on December 20, 2020
I have a figure that relates to two different issues discussed at very different point in a long document. Rather then send the reader back 50 pages to look up a figure, I would like to include the figure again at the later point.
However, I don’t want it to appear twice in the list of figures or receive a new label number.
In this example, I would like it to appear in chapter 2 as figure 2.5 and again in chapter 4 as figure 2.5.
Is there a simple way to accomplish this? I am using Xelatex Version 3.1415926-2.5-0.9999.3 from the Texlive 2013 Arch Linux package.
With caption
it's easy to avoid a caption going in the list of figures.
documentclass{book}
usepackage{caption}
newcommand{repeatcaption}[2]{%
renewcommand{thefigure}{ref{#1}}%
captionsetup{list=no}%
caption{#2 (repeated from page pageref{#1})}%
addtocounter{figure}{-1}% So that next figure after the repeat gets the right number.
}
newcommand{fakeimage}{fbox{Fake image}} % just for the example
begin{document}
frontmatter
listoffigures
mainmatter
chapter{A chapter title}
text
begin{figure}[htp]
centering
fakeimage
caption{A caption}label{figure:nice}
end{figure}
chapter{Another title}
text
begin{figure}[htp]
centering
fakeimage
caption{This is for the new figure}label{figure:dull}
end{figure}
begin{figure}[htp]
centering
fakeimage
repeatcaption{figure:nice}{A caption}
end{figure}
end{document}
It's up to you whether defining a macro holding the figure to be repeated or one for the caption text.
Correct answer by egreg on December 20, 2020
Here's one way, by stuffing the repeated figure content in a savedvbox
. However, in this case, the repeated figure will not be a float. EDITED to resolve List of Figures issue.
documentclass{article}
newsaveboxsavefigure
begin{document}
listoffigures
begin{figure}[ht]
centering
framebox{first figure}
caption{First caption}
end{figure}
saveboxsavefigure{vbox{%
centering
framebox{second figure}
}}
begin{figure}[ht]
noindentusebox{savefigure}
caption{Second caption}
end{figure}
begin{figure}[ht]
centering
framebox{third figure}
caption{Third caption}
end{figure}
{centering
medskip
noindentusebox{savefigure}par
bigskip
Figure 2: Second captionpar}
end{document}
Answered by Steven B. Segletes on December 20, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP