我正在尝试插入三幅水平排列的图片,横跨整个页面。目前,它们彼此叠放,而不是彼此相邻。
\begin{figure}[H]
\centering
\includegraphics{"Plot 2".png}
\includegraphics{"Plot 3".png}
\includegraphics{"Plot 4".png}
\caption{Data Set 1 - split by country}
\label{fig:Data Set 1 - split by country}
\end{figure}
答案1
或者简单来说:
\documentclass{article}
\usepackage{graphicx} % to use example images
%---------------------------------------------------------------%
\usepackage{showframe}% fro whow page layout
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{figure}[ht]
\centering
\includegraphics[width=0.3\linewidth]{example-image}\hfil
\includegraphics[width=0.3\linewidth]{example-image}\hfil
\includegraphics[width=0.3\linewidth]{example-image}
\caption{Data Set 1 - split by country}
\label{fig:Data Set 1 - split by country}
\end{figure}
\begin{figure}[ht]
\includegraphics[width=0.3\linewidth]{example-image}\hfill
\includegraphics[width=0.3\linewidth]{example-image}\hfill
\includegraphics[width=0.3\linewidth]{example-image}
\caption{Data Set 1 - split by country}
\label{fig:Data Set 1 - split by country}
\end{figure}
\end{document}
答案2
您可以使用水平填充来实现这一点,但是您需要给图像一个相对宽度,请查看这个:
\documentclass{article}
\usepackage{graphicx} % to use example images
\usepackage{showframe} % to show magins
\begin{document}
\begin{figure}
\includegraphics[width=0.3\linewidth]{example-image}\hspace*{\fill}%
\includegraphics[width=0.3\linewidth]{example-image}\hspace*{\fill}%
\includegraphics[width=0.3\linewidth]{example-image}
\caption{Data Set 1 - split by country}
\label{fig:Data Set 1 - split by country}
\end{figure}
\end{document}
如果您不想让图像组碰到边距(或者想要以较小的尺寸显示它们),也可以将图像组居中。只需在开头和结尾添加更多水平填充:
% Same preamble as above
\begin{document}
\begin{figure}
\hspace*{\fill}\includegraphics[width=0.3\linewidth]{example-image}
\hspace*{\fill}\includegraphics[width=0.3\linewidth]{example-image}
\hspace*{\fill}\includegraphics[width=0.3\linewidth]{example-image}\hspace*{\fill}%
\caption{Data Set 1 - split by country}
\label{fig:Data Set 1 - split by country}
\end{figure}
\end{document}