在同一页面中对齐多个图像

在同一页面中对齐多个图像

我还剩下 3/4 的页面空间来对齐 4 张图片。页面空间有限,我想让它们全部都合适。

\documentclass{article}
\usepackage{graphicx} % Required for inserting images

\title{sample}

\begin{document}

\maketitle

\begin{frame}{}
\begin{figure}[ht]
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[scale=0.45]{Figures/edaaml1.jpg}
        \caption{AMLSim: All transactions in each timestep}
        \label{fig:16}
    \end{minipage}
    \hspace{0.5cm}
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[scale=0.45]{Figures/edaaml2.jpg}
        \caption{AMLSim: SAR transactions in each timestep}
        \label{fig:17}
    \end{minipage}
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[scale=0.32]{Figures/edaellip.jpg}
        \caption{Elliptic: All transactions in each timestep}
        \label{fig:18}
    \end{minipage}
    \hspace{0.5cm}
    \begin{minipage}[b]{0.45\linewidth}
        \centering
        \includegraphics[scale=0.35]{Figures/edaellip2.jpg}
        \caption{Elliptic: Illicit transaction graph in timestep 41}
        \label{fig:19}
    \end{minipage}
\end{figure}
\end{frame}

\end{document}

目前看起来是这样的:

在此处输入图片描述

问题是图像太小(试图将其放在一页中)并且标题太拥挤。可以减少边距以容纳它们,但我只能更改此页面的边距吗(我不想破坏文档其余部分的对齐方式),或者是否有图像网格可以让我适当地调整这些数字?

答案1

我猜,你正在经历这样的事情:

在此处输入图片描述

对于上图,我们使用了framed包。框架在浮动内消失figure

\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{framed}   % for frame around images

\author{Me!}
\title{sample}
\date{\today}

\begin{document}
\maketitle

\begin{figure}[ht]
\setkeys{Gin}{width=\linewidth}
\begin{framed}  % <--
    \begin{minipage}[b]{0.45\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaaml1.jpg}
        \caption{AMLSim: All transactions in each timestep}
        \label{fig:16}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.45\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaaml2.jpg}
        \caption{AMLSim: SAR transactions in each timestep}
        \label{fig:17}
    \end{minipage}\\

\medskip  
    \begin{minipage}[b]{0.45\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaellip.jpg}
        \caption{Elliptic: All transactions in each timestep}
        \label{fig:18}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.45\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaellip2.jpg}
        \caption{Elliptic: Illicit transaction graph in timestep 41}
        \label{fig:19}
    \end{minipage}
\end{framed}
    \end{figure}
\end{document}

编辑:
或者您正在寻找以下内容:

在此处输入图片描述

(红线表示页面布局)。

在这种情况下,图形突出外边框的量为\marginparwidth+\marginparsep

\documentclass{article}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage[strict]{changepage}
\usepackage{graphicx} % Required for inserting images
\usepackage[skip=1ex,
            font=small, labelfont=bf]{caption}

\author{Me!}
\title{sample}
\date{\today}

\begin{document}
\maketitle

\lipsum[1][1-2]
\begin{figure}[ht]
\begin{adjustwidth*}{}{-\dimexpr\marginparwidth+\marginparsep}
\setkeys{Gin}{width=\linewidth}
    \begin{minipage}[b]{0.49\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaaml1.jpg}
        \caption{AMLSim: All transactions in each timestep}
        \label{fig:16}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.49\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaaml2.jpg}
        \caption{AMLSim: SAR transactions in each timestep}
        \label{fig:17}
    \end{minipage}\\

\medskip
    \begin{minipage}[b]{0.49\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaellip.jpg}
        \caption{Elliptic: All transactions in each timestep}
        \label{fig:18}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.49\linewidth}
        \includegraphics{example-image-duck}% {Figures/edaellip2.jpg}
        \caption{Elliptic: Illicit transaction graph in timestep 41}
        \label{fig:19}
    \end{minipage}
\end{adjustwidth*}
    \end{figure}
\lipsum[1][3-7]
\end{document}

相关内容