在图中布局多幅图像

在图中布局多幅图像

我有下图想要在我的论文中重现(由于许可原因有些模糊):

要重现的图:左侧块上有一张大图像,右侧块被分成 2x2 幅图像

我的 MWE 是这样的:

\documentclass{article}

\usepackage{graphicx}
\usepackage{tabularx}

\begin{document}
    \begin{figure}[tb]
        \centering

        \caption{asd}
        \label{}

        \begin{tabularx}{\textwidth}{ c c }
            \includegraphics[width=.45\linewidth,keepaspectratio]{example-image-a} & {\begin{tabularx}{.45\linewidth}{ c c }
                    \includegraphics[width=.225\linewidth,keepaspectratio]{example-image-b} & \includegraphics[width=.225\linewidth,keepaspectratio]{example-image-c} \\
                    \includegraphics[width=.225\linewidth,keepaspectratio]{example-image-b} & \includegraphics[width=.225\linewidth,keepaspectratio]{example-image-c} \\
                \end{tabularx}} \\
        \end{tabularx}

    \end{figure}

\end{document}

这导致了丑陋的布局,我不知道具体原因:

MWE的结果

我该如何修复它?

答案1

按表格形式组织图像,并测量较小图像的高度:

\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage[skip=1ex]{caption}
\usepackage{booktabs, multirow}
\newsavebox\image

\begin{document}
    \begin{figure}[tb]
    \centering
\caption{asd}
\label{fig:myimportantfigure}
    \setlength\tabcolsep{1pt}
    \setkeys{Gin}{keepaspectratio}
    \sbox\image{\includegraphics[width=0.225\linewidth,valign=t]{example-image-a}}
\begin{tabular}{c p{0.225\linewidth}p{0.225\linewidth}}
\multirow{2}{*}{\includegraphics[height=\dimexpr2\ht\image+2\dp\image+2pt,valign=t]{example-image-duck}}
    & \usebox\image & \includegraphics[width=\linewidth,valign=t]{example-image-b} \\
    \addlinespace[2pt]
    & \includegraphics[width=\linewidth,valign=t]{example-image-a} & \includegraphics[width=\linewidth,valign=t]{example-image-b} 
\end{tabular}
    \end{figure}
\end{document}

在此处输入图片描述

答案2

使用minipages 和valign=t来自adjustbox包:

在此处输入图片描述

\documentclass{article}

\usepackage{graphicx}

\usepackage[export]{adjustbox}

\begin{document}    
\begin{figure}
\caption{asd}
\label{label}
    \begin{minipage}[t]{0.5\textwidth}
         \includegraphics[width=.9\linewidth,valign=t]{example-image-a}
     \end{minipage}%
     \begin{minipage}[t]{0.5\textwidth}
         \includegraphics[width=.45\linewidth,valign=t]{example-image-b}\hfill
         \includegraphics[width=.45\linewidth,valign=t]{example-image-c}
         \includegraphics[width=.45\linewidth,valign=t]{example-image-b}\hfill
         \includegraphics[width=.45\linewidth,valign=t]{example-image-c}
     \end{minipage}
\end{figure}

\end{document}

答案3

使用 时tabularx,您必须至少使用一X列,实际上这里是 3 X 列。我给出的代码使 X列宽按比例不同2:1:1。除此之外,您需要使用\multirow。垂直调整是通过它应该跨越的等效行数完成的:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{caption, multirow}

\begin{document}

    \begin{figure}[tb]
        \centering
        \renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}
        \caption{asd}
        \label{}
        \begin{tabularx}{\textwidth}{@{} >{\hsize=1.5\hsize\centering}X *{2}{>{\hsize=0.75\hsize\centering\arraybackslash}X} @{}}
          & \includegraphics[width=0.225\textwidth,keepaspectratio]{example-image-b} & \includegraphics[width=0.225\textwidth,keepaspectratio]{example-image-c} \tabularnewline
           \multirow{-8.22}{=}{\includegraphics[width=0.45\textwidth,keepaspectratio]{example-image-a}} & \includegraphics[width=0.225\textwidth,keepaspectratio]{example-image-b} & \includegraphics[width=0.225\textwidth,keepaspectratio]{example-image-c}
        \end{tabularx}
    \end{figure}

\end{document} 

在此处输入图片描述

相关内容