5

I have four large figures which I would like to tile 2x2. These figures will need to go beyond the \textwidth boundaries but I still want the 2x2 tile centered in the page. Looking at Center figure that is wider than \textwidth I've only been able to get the \centerfloat command from this answer to produce the desired outcome. what I want from adjustbox

I'd like to be able to do this with the adjustbox package as described in this answer, but I'm having trouble getting creating the two rows of figures. Is it possible to get this functionality from the adjustbox package? I was trying to use the minipage option but haven't had success. This is what I currently get. what I current get with adjustbox

\documentclass{article}

\usepackage{subcaption}

\usepackage{mwe}% for this example only

\usepackage{adjustbox}

\begin{document}

\begin{figure}
    \begin{adjustbox}{center}
    \centering
    \begin{subfigure}{.6\textwidth}
        \includegraphics[width=1.0\linewidth]{example-image}
    \end{subfigure}%
    \begin{subfigure}{.6\textwidth}
        \includegraphics[width=1.0\linewidth]{example-image}
    \end{subfigure}
    \begin{subfigure}{.6\textwidth}
        \includegraphics[width=1.0\linewidth]{example-image}
    \end{subfigure}%
    \begin{subfigure}{.6\textwidth}
        \includegraphics[width=1.0\linewidth]{example-image}
    \end{subfigure}
    \end{adjustbox}
\end{figure}

\end{document}
5

Here is a version using \makebox.

Note: a minipage would reset \textwidth, but a \parbox doesn't.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{showframe}% MWE only

\begin{document}

\begin{figure}
\makebox[\textwidth][c]{\parbox{1.2\textwidth}{%
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}%
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}%
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}
}}
\caption{A $2\times2$ arrangement}
\end{figure}
\end{document}

full page


Here is a version using adjustbox.

\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{subcaption}
\begin{document}

\begin{figure}
  \begin{adjustbox}{center}
  \parbox{1.2\textwidth}{\lineskip=0pt
    \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
    \end{subfigure}%
    \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
    \end{subfigure}
    \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
    \end{subfigure}%
    \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
    \end{subfigure}}
  \end{adjustbox}
  \caption{Caption}
  \label{fig:key}
\end{figure}
\end{document}

Here is a version using neither,

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}

\begin{figure}
  \leftskip=-0.1\textwidth
  \rightskip=-0.1\textwidth
  \lineskip=0pt
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}%
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}%
  \begin{subfigure}{.6\textwidth}
      \includegraphics[width=\linewidth]{example-image}
  \end{subfigure}
  \caption{Caption}
  \label{fig:key}
\end{figure}
\end{document}
| improve this answer | |
  • Thanks. Your answer works well without captions, which I forgot to include in my example and have updated. The second part of the linked answer uses adjustbox, it's the center command in the line \includegraphics[width=1.2\textwidth,center]{image}%. Alternatively you can use adjustbox as \begin{adjustbox}{center} which I thought might be the way to do it. Are you able to modify your solution to work for captions, or possibly use adjustbox? – user3756 Feb 18 '17 at 7:29
  • No problem. There are many ways to overlay the margins. – John Kormylo Feb 18 '17 at 14:47
4

You need subfigure only in case you have subcaptions. Otherwise, just treat the images as if they were big letters.

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
%%% local settings
\renewcommand{\arraystretch}{0}
\setlength{\tabcolsep}{0pt}

\begin{tabular}{cc}
\includegraphics[width=0.4\linewidth]{example-image} &
\includegraphics[width=0.4\linewidth]{example-image} \\
\includegraphics[width=0.4\linewidth]{example-image} &
\includegraphics[width=0.4\linewidth]{example-image}
\end{tabular}

\caption{A $2\times2$ arrangement}

\end{figure}

\end{document}

By locally removing the interline spacing between rows (\renewcommand{\arraystretch}{0} and the intercolumn padding (\setlength{\tabcolsep}{0pt}) in the tabular, the images are placed next to each other with no space. Since the settings are done in a group (the figure environment), the values will be restored after \end{figure}, no need to reset them manually.

enter image description here

If you want oversized pictures, put the tabular in a box:

\makebox[\linewidth]{%
  \begin{tabular}{cc}
    \includegraphics[width=0.6\linewidth]{example-image} &
    \includegraphics[width=0.6\linewidth]{example-image} \\
    \includegraphics[width=0.6\linewidth]{example-image} &
    \includegraphics[width=0.6\linewidth]{example-image}
  \end{tabular}%
}
| improve this answer | |
  • Unfortunately with your example when I make the figure wider than \textwidth (e.g. width=0.6\linewidth) the figure won't center in the middle of the page - I've updated the question to try and make that clear. I've also updated my post to include captions - I removed the caption to save space but I am looking for a more general solution. Do you think adjustbox would work for this situation? – user3756 Feb 18 '17 at 7:22
  • @user3756 It's much easier than you think. I'll add it. – egreg Feb 18 '17 at 9:46
  • how much trouble is it to do the same thing but with captioned subfigures? I updated my post to mention captions because I forgot about them (sorry about that). However I could revert the question back to the original (non-caption) form and ask the caption question separately - what would you recommend? – user3756 Feb 18 '17 at 13:04
  • @user3756 Since it is a completely different question, ask a new one. And, please, avoid changing your question so as to invalidate all given answers. – egreg Feb 18 '17 at 13:20

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.