答案1
您的图形布局大致由 6 列给出tabular
,最左侧图像的高度由第一行图像顶部和第二行图像底部的垂直位置之间的差异给出。可以使用zref
的savepos
模块用于捕获页面上的节点位置,以及一些框操作(将内容存储在框中以便于测量)以自动调整较大(最左边)图像的大小。
下面的示例正是这样做的,并且每次改变小图像的高度(或图形的位置)时都需要至少两次编译。
\documentclass{article}
\usepackage{graphicx}
\usepackage[savepos]{zref}
\newlength{\smallimagewidth}
\begin{document}
\begin{figure}
\setlength{\tabcolsep}{3pt}% Space between images
\setlength{\smallimagewidth}{15mm}% Small image width
\begin{tabular}{ *{6}{c} }
% Top row of images
&
\zsaveposy{top-image}% Capture position of top row images (on the baseline)
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} \\
&
A &
B &
C &
D &
E \\
% Bottom row of images
\setbox0=\hbox{\includegraphics[width=\smallimagewidth]{example-image}}% Store top image in box
% Insert larger image (height = 'top-image' + 'height of top image' - 'bottom image')
\smash{\includegraphics[height=\dimexpr\zposy{top-image}sp+\ht0-\zposy{bottom-image}sp]{example-image}} &
\zsaveposy{bottom-image}% Capture position of lower row of images
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} &
\includegraphics[width=\smallimagewidth]{example-image} \\
AAAA &
F &
G &
H &
I &
J
\end{tabular}
\caption{A figure caption.}
\end{figure}
\end{document}
您可以通过设置不同的来更改较小图像的宽度,而图像之间的间隔则由(内列之间的常规间隙)\smallimagewidth
给出。\tabcolsep
tabular
我们使用\smash
较大的图像,这样它就不会干扰行距。这应该没有关系,因为尺寸会调整为与较小图像设置的高度一致。
答案2
一些线性代数:
\documentclass{article}
\usepackage[a4paper,margin=1cm]{geometry}
\usepackage{xfp}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htp]
% measure the x/y ratio of the images
\sbox0{\includegraphics{example-image-16x9}}
\edef\q{\fpeval{(\ht0)/(\wd0)}}
\sbox2{\includegraphics{example-image}}
\edef\r{\fpeval{(\ht2)/(\wd2)}}
% height+depth of a strut
\edef\s{\fpeval{\ht\strutbox+\dp\strutbox}}
% target width (95% of textwidth)
\edef\t{\fpeval{0.95\textwidth}}
% if x is the desired width of the big image and
% u the desired width of the small images, then
%
% x+5u=t % big image and five small ones
% qx+s=2ru+2s % big image + caption = two small images and captions
%
% the system solves as
%
% x=(2rt+5s)/(2r+5q)
% u=(qt-s)/(2r+5q)
\edef\x{\fpeval{(2*\r*\t+5*\s)/(2*\r+5*\q)}pt}
\edef\u{\fpeval{(\q*\t-\s)/(2*\r+5*\q)}pt}
\renewcommand{\arraystretch}{0}
\setlength{\tabcolsep}{0pt}
\begin{tabular}{c}
\includegraphics[width=\x]{example-image-16x9}\\
\strut BSD68: 119082
\end{tabular}\hfill
\begin{tabular}{c}
\includegraphics[width=\u]{example-image}\\
\strut GT\\
\includegraphics[width=\u]{example-image}\\
\strut DnCNN [17]
\end{tabular}\hfill
\begin{tabular}{c}
\includegraphics[width=\u]{example-image}\\
\strut Noisy ($\sigma=50$)\\
\includegraphics[width=\u]{example-image}\\
\strut MemNet [18]
\end{tabular}\hfill
\begin{tabular}{c}
\includegraphics[width=\u]{example-image}\\
\strut BM3D [63]\\
\includegraphics[width=\u]{example-image}\\
\strut IRCNN [19]
\end{tabular}\hfill
\begin{tabular}{c}
\includegraphics[width=\u]{example-image}\\
\strut TNRD\\
\includegraphics[width=\u]{example-image}\\
\strut FFDNet [20]
\end{tabular}\hfill
\begin{tabular}{c}
\includegraphics[width=\u]{example-image}\\
\strut RED [16]\\
\includegraphics[width=\u]{example-image}\\
\strut RDN (ours)
\end{tabular}
\end{figure}
\end{document}
解释。
\q
是大图片的图像比例(高度/宽度),\r
小图片的图像比例;\x
是大图片的最终宽度,\u
小图片的最终宽度;\t
是文本宽度的 95%,以允许图片之间有一定的间距;\s
是支柱的高度加上深度。
因此我们希望\x+5\u=\t
和\q\x+\s=2\r\u+2\s
。解线性系统。
\fpeval
我利用将长度返回为纯数字来表示点的长度这一事实。