在 Latex 中围绕图形绘制方框

Drawing Boxes Around Figures in Latex

我正在尝试在 LaTeX 中围绕一些图形绘制方框。我有 6 个子图,我想围绕它们成对画框。它们以 2 行 3 列布局布置,我想在 (0,0) 和 (1,0)、(0,1) 和 (1,1) 等周围画一个框

|---------|---------|---------|
| Figure1 | Figure2 | Figure3 |
|         |         |         |
| Figure4 | Figure5 | Figure6 |
|_________|_________|_________|
   caption for all figures

类似于上面的内容。

我的代码是:

\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}

您可以将它们放在 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}