1

I am having a problem aligning figures in a subfloat. Here is the raw code:

\begin{figure}
\centering 
\subfloat[]{{\includegraphics[width=.48\textwidth]{image1.pdf} }\label{}}%
\newline
\subfloat[]{{\includegraphics[width=.48\textwidth]{image2.pdf} }\label{}}%
\newline
\subfloat[]{{\includegraphics[width=.98\textwidth]{image3.pdf} }\label{}}%
\caption{}
\label{}
\end{figure}

I would expect the labels (a), (b) and (c) to be on the centreline of the page. The code gives no errors, but images 1 and 2 are not in the centerline of the page (i.e. their labels (a) and (b) are offset to the left).

I have read this might be something to do with using the width command but I am not sure how to fix it.

Thanks

0

I fixed the problem by using \\ instead of \newline in the code above. The figures now show up, one underneath the other, and correctly aligned along the vertical centreline of the page.

0

better than use \\ instead of the \newline, is to insert blank line:

\documentclass{article}
\usepackage[demo]{graphicx} % in real document remove option"demo"
\usepackage{subfig}

\begin{document}
    \begin{figure}
\centering
\subfloat[]{{\includegraphics[width=.48\textwidth]{image1.pdf} }\label{fig:mycaption-a}}

\subfloat[]{{\includegraphics[width=.48\textwidth]{image2.pdf} }\label{fig:mycaption-a}}

\subfloat[]{{\includegraphics[width=.98\textwidth]{image3.pdf} }\label{fig:mycaption-c}}
\caption{My caption}
\label{fit:mycaption}
    \end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.