1

I am using the following code to include four subfigures.

  \documentclass[a4paper, 12pt]{article}
    \usepackage[margin=0.8in]{geometry}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}
    \usepackage{subfig}
    \usepackage{float}
    \begin {document}
        \begin{figure}[H]
          \centering
          \begin{tabular}{c@{\hspace{2.5cm}}c}
          \begin{subfigure}{.4\linewidth}
            \centering
            \includegraphics[width=1.2\linewidth]{subfig_1.jpeg}
            \caption{subfig_1}
            \label{sub_1}
          \end{subfigure} &
          \begin{subfigure}{.4\linewidth}
            \centering
            \includegraphics[width=1.2\linewidth]{subfig_2.jpeg}
            \caption{subfig_2}
            \label{sub_2}
          \end{subfigure}
          \end{tabular}
          \caption{Figure:1}
        \end{figure}%
        \begin{figure}[H]\ContinuedFloat
          \begin{subfigure}{\linewidth}
            \centering
            \includegraphics[width=0.8\linewidth]{subfig_3.jpeg}
            \caption{subfig_3}
            \label{sub_3}
          \end{subfigure}
          \vspace{1cm}\par
          \begin{subfigure}{\linewidth}
            \centering
            \includegraphics[width=0.8\linewidth]{subfig_4.jpeg}
            \caption{subfig_4}
            \label{sub_4}
          \end{subfigure}
        \caption{Figure:1}
        \label{fig1}
        \end{figure}
    \end{document}

I am using "\Continuedfloat" as the subfigures 3 and 4 are supposed to be inserted in the succeeding page of the page where subfigures 1 and 2 are inserted. The subcaptions for all the four subfigures are printed. However they are not continuous i.e. The subcaption for the subfigures 1 and 2 are numbered as "(a)" and "(b)" respectively. The subcaption for the subfigures 3 and 4 is supposed to be numbered as "(c)" and "(d)" respectively. But they are also labelled as "(a)" and ("b") respectively. Also the subfigure 2 appears beyond the right margin of the page. And the subcaptions are not printed at the centre of the subfigures although I have used \centering. I am not able to figure out where I am making a mistake. Can someone please help me figure out?

I am also not sure whether the numbers ".4" and "1.2" that I am using respectively in \begin{subfigure}{.4\linewidth} and \includegraphics[width=1.2\linewidth] i.e.

\begin{subfigure}{.4\linewidth}
    \centering
    \includegraphics[width=1.2\linewidth]{subfig_1.jpeg}

are correct. As in what is the allowed factor by which the number used in \includegraphics should be less or greater than the number used in \begin{subfigure}

Aim
  • 633
  • Could you please make your code compilable by adding the documentclass as well as the relevant packages? – leandriis Dec 22 '19 at 10:10
  • 1
    If I make a minimal example using your code fragment, I can not reproduce the issues you describe. – leandriis Dec 22 '19 at 10:12
  • @leandriis Then has it got to do with the dimensions of the figures I want to insert? They are quite large I would say. The dimensions of the subfigures 1,2,3 and 4 are respectively: "1521x1180" , "1372x1158" , "1826x1245" and "1833x1405." The unit of measure being pixels – Aim Dec 22 '19 at 10:25
  • 2
    If you compile your code, you should recieve an error message about subcaption and subfig being incompatible with each other. Remove the latter. – leandriis Dec 22 '19 at 10:27
  • For the first two side by side subfigures, I'd also recomment to not use a tabular. Instead I'd use the following code: \centering \begin{subfigure}{.45\linewidth} \centering \includegraphics[width=\linewidth]{subfig_1.jpeg} \caption{subfig1} \label{sub_1} \end{subfigure} \hfill \begin{subfigure}{.45\linewidth} \centering \includegraphics[width=\linewidth]{subfig_2.jpeg} \caption{subfig2} \label{sub_2} \end{subfigure} \caption{Figure:1} This will also solve the mentioned margin problem. – leandriis Dec 22 '19 at 10:28
  • Can you please tell me how did you decide on the no ".45" used in the \begin{subfigure}{.45\linewidth}? Is that a sort of standard? – Aim Dec 22 '19 at 10:35
  • Try and error or personal preference. In my opinion, the white space between the two images is too large if one just ses 0.4. – leandriis Dec 22 '19 at 10:42
  • See my answer on question https://tex.stackexchange.com/questions/477813/. Your question is very related to this one. – Zarko Dec 22 '19 at 11:03
  • 2
    Including the subcaption and the subfig package does not work. They are not compatible. And especially subfig has its own \ContinuedFloat code which breaks \ContinuedFloat offered by subcaption. So you have to decide for one of them and drop the other one. –  Dec 22 '19 at 11:20

1 Answers1

1

After repairing your code, made small modification and consider ma answer on question, I obtain the following result:

enter image description here

\documentclass[a4paper, 12pt]{article}
\usepackage[margin=0.8in]{geometry}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin {document}
    \begin{figure}[ht]
    \centering
\begin{subfigure}{.4\linewidth}
\includegraphics[width=\linewidth]{subfig_1.jpeg}
        \caption{subfig\_1}
        \label{sub_1}
\end{subfigure}
    \hfil
\begin{subfigure}{.4\linewidth}
\includegraphics[width=\linewidth]{subfig_2.jpeg}
    \caption{subfig\_2}
    \label{sub_2}
\end{subfigure}
      \caption{Figure:1}
      \label{fig:fig-1}
\end{figure}

\begin{figure}[ht]
\ContinuedFloat
    \centering
\begin{subfigure}{0.8\linewidth}
\includegraphics[width=\linewidth]{subfig_3.jpeg}
    \caption{subfig\_3}
    \label{sub_3}
\end{subfigure}

\medskip
\begin{subfigure}{0.8\linewidth}
\includegraphics[width=\linewidth]{subfig_4.jpeg}
    \caption{subfig\_4}
    \label{sub_4}
\end{subfigure}
    \caption{Figure:1 (cont.)}
    \label{fig1}
\end{figure}
\end{document}
Zarko
  • 296,517