0

I am currently editing a long document in which the text is illustrated with numerous graphics and tables. When I started editing it the graphics were more or less close to the relevant parts of the text but I now find that in one chapter all the graphics now appear at the end of the text one after another.

I have not changed the position of the graphics in the tex document. I cannot possibly list all the changes I have made but a major change was to insert this

\begin{figure}[!ht]
\centering
\begin{subfigure}[b]{\textwidth}
    \centering
   \includegraphics[width=0.75\linewidth]{location}
   \caption{Location, $\mu$}

\end{subfigure}

\begin{subfigure}[b]{\textwidth} \centering \includegraphics[width=0.75\linewidth]{scale} \caption{Scale, $\sigma$} \label{fig:diffsc} \end{subfigure}

\begin{subfigure}[b]{\textwidth} \centering \includegraphics[width=0.75\linewidth]{shape} \caption{Shape, $\xi$} \end{subfigure} \caption{Univariate marginals by parameter: \Posteriors: black. Priors: red } \label{fig:marginals2} \end{figure}

In the pdf document this graphic appears after all the text and tables followed by all the remaining graphics in the chapter. The location of graphics in other chapters has not changed: they are where they should be.

Can anyone suggest how to get the graphics in this chapter back in their proper places?

JeremyC
  • 347
  • 4
    see https://tex.stackexchange.com/a/39020/2388 for a description how floats move in LaTeX, why they sometimes pills up at the end of a chapter, and how to correct that. – Ulrike Fischer Feb 09 '24 at 14:35
  • 3
    Remember that only [!ht] is not a good idea, always throw p in as well if the figure ends up being large. – daleif Feb 09 '24 at 14:46
  • @daleif Thanks. I remember now inserting the ! in an attempt to regain control of where my graphic was placed. It did not work! – JeremyC Feb 09 '24 at 15:47
  • @UlrikeFischer Very many thanks for the reference to the paper. I am just starting to read it. – JeremyC Feb 09 '24 at 15:48
  • @UlrikeFischer Update: I have read it and I have been able to solve my problem. Thanks again. – JeremyC Feb 09 '24 at 16:33
  • 1
    Tips: (1) Pay full attention to the first comment (2) Initially, do not fix any option in the floats. (3) Try to intersperse the floats in the text. (4) If you have too much figures, relax the LateX rules (remember advice 1). (5) Fix options only in the final versions and only if this is really needed( just in case it's not really the last version) and remember that p option is nice when you have too many images. – Fran Feb 11 '24 at 10:20
  • @Fran thanks for this very clear advice. The document @UlrikeFischer pointed to is good but not an easy read. Your points (2) - (5) are very clear. I solved my problem, before reading your comment, with (2), (3) and using the p option for two big floats. As to (5) I am not quite at the final version but I did want to be sure I knew how to fix options when the time comes. – JeremyC Feb 11 '24 at 11:10
  • @JeremyC Yes, it is difficult to understand, but you have to know the ethology of the hairy beast so that it does not bite you when you least expect. See also here and here to catch the main points of (4). – Fran Feb 11 '24 at 12:05
  • @JeremyC A simple document with lipsum package for dummy text and some macros to make easily dummy floats (e.g. \def\img{\begin{figure}\rule{\linewidth}{.75\linewidth}\caption{Foo}\end{figure}} for a big figure) and then just write some like \lipsum[1][1-4] \img \img \lisum[2] \img .... could help to play with the settings of topnumber, \texfraction or whatever, and test easily the result. – Fran Feb 11 '24 at 12:07

0 Answers0