10

I want to have a following layout of pictures: enter image description here

I'm using subfigures:

\documentclass[12pt, a4paper]{report}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{subcaption}
\usepackage{graphicx,xcolor}
\usepackage[framemethod=tikz]{mdframed}

\newcommand{\fakeimage}{{\fboxsep=-\fboxrule\fbox{\rule{0pt}{3cm}\hspace{4cm}}}}

\begin{document}

\begin{figure} \centering \begin{subfigure}{.3\linewidth} \centering \fakeimage \caption{Image}\label{fig:image1} \end{subfigure} %

\hfill

\begin{subfigure}{.3\linewidth}
    %\centering
    \fakeimage
    \caption{Image}\label{fig:image12}
\end{subfigure}

\hfill

\begin{subfigure}{.3\linewidth}
    \centering
    \fakeimage
    \caption{Image}\label{fig:image12}
\end{subfigure}

\hfill

\begin{subfigure}{\linewidth}
    \centering
    \fakeimage
    \caption{Image}\label{fig:image3}
\end{subfigure}

\RawCaption{\caption{General caption}
\label{fig:images}}

\end{figure}

\end{document}

I'm getting:

enter image description here

xXx
  • 103
DomDom
  • 153
  • 6
    Eliminate the blank lines between subfigures 1, 2, and 3. Remember: In TeX and LaTeX, a blank line (in text mode) generates a line break. – Mico Aug 10 '16 at 18:54
  • @Mico, I'm really sorry - repost your answer, and I'll ask DomDom to unaccept mine and accept yours. Then I'll delete mine. – auden Aug 10 '16 at 19:07
  • @heather - Not to worry! – Mico Aug 10 '16 at 19:09

1 Answers1

12

As Mico said, eliminate the blank lines. Here's the code:

\documentclass[12pt, a4paper]{report}
\usepackage{caption}
\usepackage{floatrow}   
\usepackage{subcaption}
\usepackage{graphicx,xcolor} 
\usepackage[framemethod=tikz]{mdframed}

\newcommand{\fakeimage}{{\fboxsep=-\fboxrule\fbox{\rule{0pt}{3cm}\hspace{4cm}}}}

\begin{document}

\begin{figure}
\centering
\begin{subfigure}{.3\linewidth}
    \centering
    \fakeimage
    \caption{Image}\label{fig:image1}
\end{subfigure}
    \hfill
\begin{subfigure}{.3\linewidth}
    \centering
    \fakeimage
    \caption{Image}\label{fig:image12}
\end{subfigure}
   \hfill
\begin{subfigure}{.3\linewidth}
    \centering
    \fakeimage
    \caption{Image}\label{fig:image13}
\end{subfigure}

\bigskip
\begin{subfigure}{\linewidth}
  \centering
  \fakeimage
  \caption{Image}\label{fig:image3}
\end{subfigure} 
\RawCaption{\caption{General caption}
\label{fig:images}}
\end{figure}

\end{document}

And here's the result:

enter image description here

Hope this helps!

Thanks to Mico for the solution (see comments)!

auden
  • 1,458
  • 2
    +1. You may want to add a \bigskip directive ahead of the fourth subfigure. – Mico Aug 10 '16 at 19:09
  • @Mico: thank you. I have done so and compiled it; however, there is no noticeable difference. – auden Aug 10 '16 at 19:14
  • 1
    Remove the final \hfill, insert a blank line, and insert \bigskip after the blank line (and before the final subfigure). – Mico Aug 10 '16 at 19:17
  • @Mico: ah. Looks much better. I'll update the answer. – auden Aug 10 '16 at 19:17