减少带有子图的图形的边距

减少带有子图的图形的边距

我有一个包含 4 个子图的图形,如下所示

\begin{figure}[h]
\centering
 \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{1}
   \caption{1}
  \end{subfigure}
   \begin{subfigure}[t]{0.49\textwidth}
   \includegraphics[width=\textwidth]{2}
  \caption{2}
  \end{subfigure}
   \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{3}
    \caption{3}
  \end{subfigure}
   \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{4}
    \caption{4}
 \end{subfigure}
\caption{blabla}
\end{figure}

我想减少这个图的边距(左右)(这意味着图像应该大于文本)。

我尝试使用几何环境来增加文本宽度,但是它似乎会影响整个页面,将所有内容放在\restoregeometry下一页之后。

\newgeometry{textwidth=18cm}
\restoregeometry

答案1

你是說這樣嗎?

% arara: pdflatex

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage[export]{adjustbox}

\begin{document}
\blindtext
\begin{figure}[h]
    \begin{subfigure}[t]{0.46\textwidth}
        \includegraphics[width=1.1\linewidth,center]{1}
        \caption{1}
    \end{subfigure}\hfill
    \begin{subfigure}[t]{0.46\textwidth}
        \includegraphics[width=1.1\linewidth,center]{2}
        \caption{2}
    \end{subfigure}%

    \begin{subfigure}[t]{0.46\textwidth}
        \includegraphics[width=1.1\linewidth,center]{3}
        \caption{3}
    \end{subfigure}\hfill
    \begin{subfigure}[t]{0.46\textwidth}
        \includegraphics[width=1.1\linewidth,center]{4}
        \caption{4}
    \end{subfigure}%
    \caption{blabla}
\end{figure}
\blindtext
\end{document}

答案2

changepage对于边缘、用途及其环境的局部改变adjustwidth

要设置子图的宽度,请在基础环境\linewidth中适当使用。对于子图中图像的宽度,请使用,它指的是子图的规定宽度。listadjustwidth\textwidth

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage{changepage}

\begin{document}

\blindtext

\begin{figure}[htp]
\begin{adjustwidth}{-1cm}{-1cm}
\centering

\begin{subfigure}[t]{0.49\linewidth}
  \centering
  \includegraphics[width=\textwidth]{example-image}
  \caption{1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.49\linewidth}
  \centering
  \includegraphics[width=\textwidth]{example-image}
  \caption{2}
\end{subfigure}

\begin{subfigure}[t]{0.49\linewidth}
  \centering
  \includegraphics[width=\textwidth]{example-image}
  \caption{3}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.49\linewidth}
  \centering
  \includegraphics[width=\textwidth]{example-image}
  \caption{4}
\end{subfigure}

\end{adjustwidth}

\caption{blabla}

\end{figure}

\blindtext

\end{document}

在此处输入图片描述

答案3

要取出魔法:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{showframe}

\newenvironment{widespace}[1]% #1 = width
{\dimen0=#1\relax% only one error message for bad #1
 \dimen1=\dimexpr 0.5\dimen0 - 0.5\textwidth\relax
 \hspace*{-\dimen1}\minipage{\dimen0}}%
{\endminipage\hspace{-\dimen1}}

\begin{document}
\begin{figure}[h]
\begin{widespace}{6in}
 \centering
 \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{1}
   \caption{1}
  \end{subfigure}\hfil
   \begin{subfigure}[t]{0.49\textwidth}
   \includegraphics[width=\textwidth]{2}
  \caption{2}
  \end{subfigure}

   \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{3}
    \caption{3}
  \end{subfigure}\hfil
   \begin{subfigure}[t]{0.49\textwidth}
    \includegraphics[width=\textwidth]{4}
    \caption{4}
 \end{subfigure}
\caption{blabla}
\end{widespace}
\end{figure}
\end{document}

相关内容