# Arrange four images with letter captions and vertical/horizontal separators

I would like to arrange four images in a similar style to this code taken slightly modified from Four Arranged Figures are offset .

\documentclass{article}
\usepackage[demo]{graphicx} % leave off demo option in real program
\renewcommand{\thefigure}{\alph{figure}}
\begin{document}

\begin{figure}
\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth]{a.pdf}
\caption{a)}
\label{fig:immediate}
\end{minipage}

\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth]{b.pdf}
\caption{b)}
\label{fig:proximal}
\end{minipage}

\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth]{c.pdf}
\caption{c)}
\label{fig:distal}
\end{minipage}

\begin{minipage}[t]{0.5\textwidth}
\includegraphics[width=\linewidth]{d.pdf}
\caption{d)}
\label{fig:combined}
\end{minipage}

\end{figure}
\end{document}


My images are mostly white so I would like them to touch but to add a vertical and horizontal line in a cross shape to separate them. The two lines should cross in the middle and stretch to the top and bottom and left and right of the images respectively.

We can achieve this by using subcaption.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}

\begin{figure}
\subcaptionbox{caption}{\includegraphics[width = 2in]{b}}\\
\subcaptionbox{caption}{\includegraphics[width = 2in]{b}}
\end{figure}
\end{document}


If you want to caption the 4 subfigures, add \caption{caption} below the lase \subcaptionbox. This will then call this figure 1: caption

To separate the figures with a line, we can use the tabular environment.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption, tabu}
\begin{document}
\begin{figure}
\begin{tabular}{c|c} %vertical line I added | between cc
\subcaptionbox{caption}{\includegraphics[width = 2in]{a}}&
\subcaptionbox{caption}{\includegraphics[width = 2in]{b}}\\
\hline
\subcaptionbox{caption}{\includegraphics[width = 2in]{a}}&
\subcaptionbox{caption}{\includegraphics[width = 2in]{b}}
\end{tabular}
%\caption{caption} %this is the caption for the whole figure delete % in front of caption if you want it.
\end{figure}
\end{document}


At present, the demo graphic butts up against the bounding box, but since you figures are mostly white, as you stated, the line should be seen without blending into the picture as with the demo.

• Thank you. I have a few questions. I can use \subcaptionbox{}{\includegraphics[width = 2in]{a}} to get rid of the caption text but how can I move the (a), (b) etc. vertically? Also, I am not sure how to add the vertical/horizontal thin separating line. ([demo] needs a white counterpart for this too.) – Lembik Aug 12 '13 at 19:04
• Yes I would like to be able to move it right up to the picture or even onto it. My picture is mostly white as I say. – Lembik Aug 12 '13 at 19:11
• @Lembik there is an opening question on that right now:subfigures with number inside figure I don't know if the answer works but you can try it or wait for someone to pose another answer that is accepted. – dustin Aug 12 '13 at 19:15
• Thanks. Is there an equivalent vertical line? – Lembik Aug 12 '13 at 19:19
• The current answer at tex.stackexchange.com/questions/127853/… doesn't seem to move the caption vertically sadly. The answer looks like it is at tex.stackexchange.com/questions/45990/… but \setlength{\belowcaptionskip}{0pt} has no effect for me. – Lembik Aug 12 '13 at 19:49