1

I have a figure (let's call it figure 11 ) which has 3 subfigures inside. Figures 11A and B display perfectly in one page of the compiled pdf. The issue at hand is... figure 11C is stuck in the center (horizontally and vertically, I mean right in the middle) of the next page … What I really would need is only figure 11c on the top of the page, and below fig 11C the next subsection and the rest of the thesis.

Can't find what code will archieve this, I have tried using t and !ht but no changes. Nothing seems to work, here I pasted the code.

    \documentclass{report}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}
    \begin{document}
    \begin{figure}[ht!]
        \centering
        \caption{BLA}
        \label{fig:11}
        \begin{subfigure}{0.8\textwidth}
            \centering
            \includegraphics[width=\textwidth]{anygraph.pdf}
            \caption{haha}
            \label{fig:11A}
        \end{subfigure}
        \hfill
        \begin{subfigure}{0.8\textwidth}
            \centering
            \includegraphics[width=\textwidth]{secondgraph.pdf}
            \caption{haha2}
            \label{fig:11B}
        \end{subfigure}
        \hfill
    \end{figure}     
    \begin{figure}[!ht] \ContinuedFloat       
        \begin{subfigure}{0.8\textwidth}
            \centering
            \includegraphics[width=0.8\textwidth]{anygraph3.pdf}
            \caption{haha3}
            \label{fig:11C}
        \end{subfigure}
        \hfill
    \end{figure}
\subsubsection{New}
babababababa
\end{document}

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Fred21
  • 13
  • What happens if you replace \begin{figure}[ht!] \ContinuedFloat with \clearpage \begin{figure}[!t] \ContinuedFloat \caption{BLA, cont'd} \centering? – Mico May 27 '22 at 18:24
  • Off-topic: You should probably replace the first \hfill directive with \par\bigskip and get rid of the second \hfill directive entirely. – Mico May 27 '22 at 18:30
  • @Mico It works like charm! Finally! but figure 11C now is not in top center. It appears in the top left corner of the page, and below it I can see the new section and the rest of the information! but how?? I mean whoa! amazing bro. Regarding /par and /parskip, whats their function?? do they go in separate lines??? – Fred21 May 27 '22 at 18:31
  • I'm guessing \includegraphics[width=0.8\textwidth]{anygraph3.pdf} in the third subfigure is a mistake. Should it be \includegraphics[width=\textwidth]{anygraph3.pdf}? – Mico May 27 '22 at 18:33
  • About \hfill: The first instance does nothing useful at all, since there's not enough space to place two subfigures side by side. \par forces a line break, and \bigskip adds a bit of vertical separation between the first subcaption and the next graph. – Mico May 27 '22 at 18:34
  • 1
    @Mico I marked your answer as valid, it completely solved it, now it's all centered and beautiful, thank you very much!! I'm so happy – Fred21 May 27 '22 at 19:18

1 Answers1

1

(expanding on my earlier comments, so that this query may be deamed to have received an "official" answer)

I would like to suggest that you insert \clearpage between the two parts of Figure 11.

\documentclass{report} 
\usepackage[demo]{graphicx} % remove 'demo' option in real document
\usepackage[skip=0.5\baselineskip]{caption}
\usepackage{subcaption}

\begin{document}

\addtocounter{figure}{10} % just for this example

\begin{figure}[ht!] \centering \caption{BLA}\label{fig:11} \begin{subfigure}{0.8\textwidth} \includegraphics[width=\textwidth]{anygraph} \caption{haha}\label{fig:11A} \end{subfigure}

\bigskip
\begin{subfigure}{0.8\textwidth}
    \includegraphics[width=\textwidth]{secondgraph}
    \caption{haha2}\label{fig:11B}
\end{subfigure}
\hfill

\end{figure}

\clearpage % <-- new

\begin{figure}[!t] \ContinuedFloat \caption{BLA, cont'd} \centering \begin{subfigure}{0.8\textwidth} \includegraphics[width=\textwidth]{anygraph3} \caption{haha3}\label{fig:11C} \end{subfigure} \end{figure}

\subsubsection{New} babababababa \end{document}

Mico
  • 506,678
  • 1
    I marked your answer as valid, it completely solved it, now it's all centered and beautiful, thank you very much!! I'm so happy – Fred21 May 27 '22 at 19:18