# Over margin subfigure caption overlay

I am trying to reproduce the example I found here: Figure with two side-by-side subfigures that is wider than textwidth

I want the same excat thing. The issue is that my captions are very extensive. If I do it like in the example my captions start to overlap. Is there a way that I can tell my captions to behave responsible and still extend my images:

\documentclass[11pt,twocolumn]{article}
\usepackage{graphicx,caption,subcaption}
\usepackage{natbib}
\usepackage{rotating}

\begin{document}
\onecolumn
\begin{figure}
\makebox[\linewidth][c]{%
\begin{subfigure}[b]{.65\textwidth}
\centering
\includegraphics[width=.95\textwidth]{someImage.png}
\label{SED}
\end{subfigure}%
\begin{subfigure}[b]{.65\textwidth}
\centering
\includegraphics[width=.95\textwidth]{someImage.png}
\label{SED1}
\end{subfigure}%
}
\makebox[\linewidth][c]{%
\begin{subfigure}[b]{.65\textwidth}
\centering
\includegraphics[width=.95\textwidth]{someImage.png}
\caption{asdmlasjkdasdnlansflnalsnflkansflnaslfnlkasnflkansofnaosnfoansofnaosnfoansfonasofnoasnfoqnfonoansifnaisjfnasnfi}
\label{SED2}
\end{subfigure}%
\begin{subfigure}[b]{.65\textwidth}
\centering
\includegraphics[width=.95\textwidth]{someImage.png}
\label{SED3}
\end{subfigure}%
}
\caption{
\end{figure}

\end{document}


which gives:

• Use \captionsetup from the caption package, as explained in subcaption's manual, to alter the width? – cfr Mar 18 '17 at 0:52
• Great! exactly what I needed. – Sebastiano1991 Mar 18 '17 at 1:05
• Unless you add a few spaces into your random text, LaTeX can't break it. Also, the paper is only about 4pt wider than the figure. – John Kormylo Mar 19 '17 at 1:32
• Also, you need to add some space between the subfigures to prevent the captions from running into each other. \hfill won't do anything as there is no space left inside the makebox. \hspace{\columnsep} would be good, but probably won't fit the page. – John Kormylo Mar 19 '17 at 1:46

Edit: Apparently in my first attempt I miss important point: images has to be wider than text width (as noted *John Kormylo in his comment below; thank you John). For this I suggest to use packed changepage, which enable to control figure protrusion out of text width separately on both text sides. Answer below is corrected accordingly

I suppose, that you looking for something like this:

• delete \makebox[\linewidth][c]{% ...} and replaced with \begin{adjustwidth*}{}{-11mm} ... \end{adjustwidth*}
• for sub figure width I select 0.48\linetwidth
• for figures width in subfigure I select \linewidth
• change subfigure position options to [t]

For show page layout the package showframe is added, in real use it had to be removed.

For text in captions I use dummy text from lispum package. Texts in your captions actually is one long word with which LaTeX has trouble to break into more lines.

\documentclass[11pt,twocolumn]{article}
\usepackage{caption,subcaption}
\usepackage[demo]{graphicx}
\usepackage[strict]{changepage}

\usepackage{lipsum}% for dummy text in captions
\usepackage{showframe}% to show page layout

\begin{document}
\onecolumn
\begin{figure}
\begin{subfigure}[t]{.48\linewidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[2]}
\label{SED}
\end{subfigure}\hfill
\begin{subfigure}[t]{.48\linewidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[11]}
\label{SED1}
\end{subfigure}

\begin{subfigure}[t]{.48\linewidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[11]}
\label{SED2}
\end{subfigure}\hfill
\begin{subfigure}[t]{.48\linewidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[3]}
\label{SED3}
\end{subfigure}%
\caption{The main caption}
\end{figure}

\end{document}

• I believe the point was to push into the margins on both sides. – John Kormylo Mar 19 '17 at 1:51
• @JohnKormylo, probably. Apparently this I didn't observe. I change my answer accordingly. – Zarko Mar 19 '17 at 4:50

The problem with both the \makebox trick and changepage package is that they push symmetrically into the margins, which is fine when the text area is centered in the paper.

The following effects a margin of \columnsep at the edge of the paper and between the two subfigures. For generality I included code for twoside documents as well (it may take two runs).

\documentclass[11pt,twocolumn]{book}
\usepackage{caption,subcaption}
\usepackage[demo]{graphicx}
\usepackage{ifoddpage}% for twoside documents

\usepackage{lipsum}% for dummy text in captions
\usepackage{showframe}% to show page layout

\newlength{\tempwidth}

\begin{document}
%\null\newpage
\onecolumn
\begin{figure}
\setlength{\tempwidth}{\dimexpr .5\paperwidth-1.5\columnsep}%
\checkoddpage
\ifoddpageoroneside
\setlength{\leftskip}{\dimexpr \columnsep-1in-\oddsidemargin}%
\setlength{\rightskip}{\dimexpr \columnsep+1in+\oddsidemargin+\textwidth-\paperwidth}%
\else
\setlength{\leftskip}{\dimexpr \columnsep-1in-\evensidemargin}%
\setlength{\rightskip}{\dimexpr \columnsep+1in+\evensidemargin+\textwidth-\paperwidth}%
\fi
\begin{subfigure}[t]{\tempwidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[2]}
\label{SED}
\end{subfigure}\hfill
\begin{subfigure}[t]{\tempwidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[11]}
\label{SED1}
\end{subfigure}

\begin{subfigure}[t]{\tempwidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[11]}
\label{SED2}
\end{subfigure}\hfill
\begin{subfigure}[t]{\tempwidth}% <-- changed
\includegraphics[width=\linewidth]{someImage.png}
\caption{\lipsum*[3]}
\label{SED3}
\end{subfigure}%
\caption{The main caption}
\end{figure}

\end{document}