我尝试使用minipage
和使图片在顶部对齐,而标题在底部位于同一行tabular
。我还需要在每个我想直接放置在其下方的图像下写上源标题(我已经尝试这样做了)。
我的尝试:产生以下结果:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}
\newcommand{\imagesource}[1]{{\scriptsize Source: #1}}
\begin{document}
\begin{figure}[H]
\centering
\makebox[\textwidth]{\makebox[1\textwidth]{%
% \begin{minipage}[t][][b]{0.2\textwidth}
\begin{minipage}[t]{.5\textwidth} % [t][][b]
\centering
\begin{tabular}{ @{} r @{} }
\includegraphics[width = .9\linewidth]{image1.png} \\
\imagesource{(EU 2020)}
\end{tabular}
\caption{This is a caption for the first image.}\label{fig:image1}
\end{minipage}\hfill
\begin{minipage}[t]{.5\textwidth}
\centering
\begin{tabular}{ @{} r @{} }
\includegraphics[width = .5\linewidth]{image2.png} \\
\imagesource{(IEA 2019)}
\end{tabular}
\caption{This is a caption for the second image.}\label{fig:image2}
\end{minipage}\hfill}
}
\end{figure}
\end{document}
答案1
以下应产生预期的输出:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}
\usepackage[export]{adjustbox}
\newcommand{\imagesource}[1]{{\scriptsize Source: #1}}
\begin{document}
\begin{figure}[H]
\centering
\begin{minipage}[t]{.475\textwidth} % [t][][b]
\centering
\begin{tabular}[t]{ @{} r @{} }
\includegraphics[width = .9\linewidth,valign=t]{example-image} \\
\imagesource{(EU 2020)}
\end{tabular}
\end{minipage}\hfill
\begin{minipage}[t]{.475\textwidth}
\centering
\begin{tabular}[t]{ @{} r @{} }
\includegraphics[width = .5\linewidth,valign=t]{example-image} \\
\imagesource{(IEA 2019)}
\end{tabular}
\end{minipage}
\begin{minipage}[t]{.475\textwidth}
\caption{This is a caption for the first image.}\label{fig:image1}
\end{minipage}\hfill
\begin{minipage}[t]{.475\textwidth}
\caption{This is a caption for the second image.}\label{fig:image2}
\end{minipage}
\end{figure}
\end{document}
答案2
我会用和来做到这floatrow
一点copyrightbox
:
\documentclass{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{copyrightbox}
\newcommand{\imagesource}[1]{{\scriptsize Source: #1}}% doesn’t work with floatrow
\begin{document}
\begin{figure}[H]
\centering
\floatsetup{heightadjust=object, valign=t}\captionsetup{textfont=it}
\begin{floatrow}
\ffigbox[\FBwidth]{\caption{Laurel \& Hardy, Busy Bodies.}\label{fig:image1}}{%
\copyrightbox[b]{\includegraphics[width = \linewidth]{Busy_Bodies}}{\raggedleft(EU 2020)}
}
\ffigbox[\FBwidth]{\caption{The Hunting of the Snark.}\label{fig:image2}}{%
\copyrightbox[b]{\includegraphics[width = 0.8\linewidth]{snark}}{\raggedleft(IEA 2019)}
}
\end{floatrow}
\end{figure}
\end{document}