4

I keep writing my text, and possibly even shuffling the content a little bit. So I might really miss where a figure is first referenced. To solve this, I put all my figures in figures.tex file (a portion is given in following as an example), and then I want LaTeX to put each figure as close as possible to the first reference. But it seems I am missing a point, because LaTeX puts all the figures one after the other right at the place I input the figures.tex file. Any suggestion ?

I have a .tex file that has all my figures one after the other, a portion as example:

\begin{figure}
    \centering
    \includegraphics[width=1\textwidth]{Figures/Hello.jpg}
    \caption[Hello]
    {
        some description
    }
    \label{figure:Hello}
\end{figure}

\begin{figure}
    \centering
    \includegraphics[width=1\textwidth]{Figures/World.jpg}
    \caption[World]
    {
        some description
    }
    \label{figure:World}
\end{figure}

Possible scenario: I'm talking about a scenario that has lots of changes. For instance, when you're writing a text, you decide to put a figure in the conclusion section in conclusion.tex, then you decide that it might be a good idea to reference the figure in the introduction section. What happens is that your figure is still in the conclusion section and you have referenced it in the introduction so the figure is shown far from first reference. To address this problem, I would like to keep all figures in one file and make latex put them as closes as possible to first reference. So in the scenario, at first (when the figure is not reference in introdcution) the figure is drawn at conclusion, and when you add a reference in introduction the figure appears in introduction (the first place it is cited).

I checked this and this questions, but they don't provide answers to my question.

  • may you add in image of the results that you would like? – Giacomo Alessandroni Dec 22 '15 at 09:36
  • sorry if my question is not clear, I update my question. – Dr. Strangelove Dec 22 '15 at 10:06
  • 3
    Latex has no support for what you are trying to do (it would be possible to do something but require quite a lot of coding). The model latex uses is that the figure environment is placed near the first reference and latex tries to place the figure near that, so by putting all the figures in one file you are requesting that they all come close together. – David Carlisle Dec 22 '15 at 11:13
  • you can use the package showkeys in a draft to print out the labels in the margin, and their references in small type above their references. while not perfect, it's better than searching through unmarked text. – barbara beeton Dec 22 '15 at 13:57

0 Answers0