I'm trying to draw boxes around some figures in LaTeX. I have 6 sub-figures and I want to draw boxes around pairs of them. They're laid out in 2 rows and 3 columns layout and I want to draw a box around (0,0) and (1,0), (0,1) and (1,1), etc.
|---------|---------|---------|
| Figure1 | Figure2 | Figure3 |
| | | |
| Figure4 | Figure5 | Figure6 |
|_________|_________|_________|
caption for all figures
Something like the above.
The code I have is:
\begin{figure}[ht]
\centering
\includegraphics[width=0.23\textwidth]{Figure1.pdf}\hfill
\includegraphics[width=0.23\textwidth]{Figure2.pdf}\hfill
\includegraphics[width=0.23\textwidth]{Figure3.pdf}
\includegraphics[width=0.23\textwidth]{Figure4.pdf}\hfill
\includegraphics[width=0.23\textwidth]{Figure5.pdf}\hfill
\includegraphics[width=0.23\textwidth]{Figure6.pdf}
\caption{This is the caption.}
\end{figure}
You could place them in a table:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{array}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{figure}[ht]
\begin{tabularx}{\linewidth}{|Y|Y|Y|}
\hline
\includegraphics[width=0.23\textwidth]{example-image-duck}&
\includegraphics[width=0.23\textwidth]{example-image-duck}&
\includegraphics[width=0.23\textwidth]{example-image-duck}\\
\includegraphics[width=0.23\textwidth]{example-image-duck}&
\includegraphics[width=0.23\textwidth]{example-image-duck}&
\includegraphics[width=0.23\textwidth]{example-image-duck}\\
\hline
\end{tabularx}
\caption{This is the caption.}
\end{figure}
\end{document}