1

I have a figure with 4 subfigures like the following

\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}

and I'd like to reduce the margins (right and left) just for this figure (that means that the image should be larger than the text).

I've tried to increase the textwidth with the geometry environment but it seems to affect the whole page, putting all that is after the \restoregeometry in the next page.

\newgeometry{textwidth=18cm}
\restoregeometry
  • This has come up before. The solution is to overlap the margins in a way that doesn't cause error messages. – John Kormylo Aug 4 '16 at 14:18
0

Do you mean like this?

% 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}
1

For a local change of margins, use changepage and its adjustwidth environment.

For setting the width of the subfigures, use \linewidth as appropriate in a list based environment, which adjustwidth is. For the width of the images in the subfigures, use \textwidth, that refers to the subfigure's stated width.

\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}

enter image description here

0

To take the magic out:

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.