2

I reference the float in different chapters. To make it easier for the reader, I would like to repeat the whole float, so the reader does not need to flick back to the chapter where the float occurred first. How does one do that properly? Ideally, it should involve the float's label to determine which float should be repeated and should make it possible to give it a new label command.

This is not a duplicate to Using the same figure twice with no new number because neither do I want to repeat the same figure number nor does the answer solve the problem of repeating the content (image or table).

\documentclass{book}
\usepackage{float}
\usepackage{graphicx}
\usepackage{nameref}
\usepackage{refstyle}

\begin{document}

\chapter{One}

Consider \figref{MyImage}.

\begin{figure}
\includegraphics{example-image-a}
\caption{My Image\label{fig:MyImage}}
\end{figure}

\chapter{Two}

Consider again \figref{MyImageAgain}.

% Some command to repeat a figure with two arguments
% 1. its label, "fig:MyImage", so it is known what should be repeated
% 2. its new custom label command, "\label{fig:MyFigureAgain}"
% - repeats its content
% - sets its caption to \caption{\nameref{fig:MyImage} (repeated from page \pageref{fig:MyImage})}.
% - set its label by using "\label{fig:MyFigureAgain}"
% So it should produce something like
%
% \begin{figure}
% \includegraphics{example-image-a}
% \caption{\nameref{fig:MyImage} (repeated from page \pageref{fig:MyImage})\label{fig:MyImageAgain}}
% \end{figure}

\end{document}
Daniel
  • 1,787
  • I can't imagine a document with 1000 figures, all of them are the same. –  Apr 11 '19 at 08:06
  • @JouleV Why 1000? Just a couple of figures get repeated. Or am I missing something? – Daniel Apr 11 '19 at 08:08
  • Honestly, you are destroying the meaning of figure numbering and labels. –  Apr 11 '19 at 08:11
  • @JouleV How is that? And what would your alternative suggestion be? – Daniel Apr 11 '19 at 08:12
  • I would do normally: give your figure a number and a label, and reference it throughout the document using something like From figure 3.15 we have blah. –  Apr 11 '19 at 08:13
  • @JouleV The problem is that people will have to go back to that figure. That is very cumbersome especially if the text should be read while checking the figure. – Daniel Apr 11 '19 at 08:15
  • @Daniel: If you have so many pages to write about a single image that fits on one (double) page so that it becomes cumbersome and necessary to keep flicking back to it, then your image/table carries way too much information for anyone to grasp. And consequently they will not care about what you have to say. You ought to structure your information so that it can be communicated without writing 20+ pages about the same image/table until it becomes a mechanical problem for your readers. – Bananguin Apr 11 '19 at 08:36
  • @Bananguin While it is true that the image carries more information than can be very easily remembered, I do not write 20+ pages about it. It is only three pages about an image that occurs in a previous chapter. Still, I want the reader to spare the annoyance of going back. Is that unreasonable? – Daniel Apr 11 '19 at 08:53
  • @Daniel: Yes. You do not get to presume if, when and how often readers want to look at images. You will be wrong in most cases, no matter what you presume. However, showing the same information multiple times throughout your document is confusing. Especially when it's only 3 pages. – Bananguin Apr 11 '19 at 08:59
  • @Bananguin I am actually not presuming but got that feedback from readers of the draft. – Daniel Apr 11 '19 at 09:30
  • 3
  • @Bananguin I don't think so. But anyway good idea to point that out as I did now. – Daniel Apr 11 '19 at 13:30
  • @Daniel: Both answers to that question do precisely what you are looking for. The accepted answer puts the same content into three (!) different floats by defining a macro. The other answer uses a savebox and introduces itself with the sentence "Here's one way, by stuffing the repeated figure content in a saved \vbox", If you do not think that is a valid approach to repeat the content of a figure, you have not been paying attention. – Bananguin Apr 11 '19 at 13:44
  • @Bananguin Thanks. I might be too blind to see but it seems none of the answers do precisely what I am looking for. For example, I cannot use a floats in a command to repeat the float. At best, they are ways to do something like I want. That is good to know but no answer. – Daniel Apr 11 '19 at 16:00
  • 1
    @Daniel With your more elaborate wording, I'd change my vote to make this question a duplicate of that question. – Bananguin Apr 13 '19 at 21:09
  • @Bananguin Thanks. But none of the solutions there automatically repeats the content of the figure. However, maybe to do this just by its label is too much to ask for. – Daniel Apr 14 '19 at 06:06
  • 1
    @Daniel You are incredibly frustrating. Your question is almost word by word the same. The described problem is painstakingly similar. Werners answer provides a macro \reusefigure which takes two parameters: placement information (which is optional) and a label and it does automatically repeat the content. I have no idea what you are looking for. – Bananguin Apr 14 '19 at 06:29
  • @Bananguin Thanks a lot for not giving up on me! I think this time you are actually right. Werner's answer's latter part seems to do what I want. (To avoid being frustrated you can try to point more directly to a particular part of an answer. In particular, if you have marked the question as a duplicate that is none which frustrates the autor of the question.) – Daniel Apr 14 '19 at 06:52

1 Answers1

1

A hack but how about defining macros for the body of the figures (including the caption but without the label) and using those? You did say that you were only concerned about a couple of figures. Something along the lines (untested):

\newcommand{\figa}[1]{main contents of figure \caption{#1}}
\newcommand{\figb}[1]{contents of another figure \caption{#1}}
...
\begin{figure}
  \centering
  \figa{First caption}
  \label{figafirst}
\end{figure}
In figure \ref{figafirst} ...
...
\begin{figure}
  \centering
  \figa{Modified caption}
  \label{figanext}
\end{figure}
Figure \ref{figafirst} is repeated as \ref{figanext}.

% and so on
Peter Wilson
  • 28,066