[Tex/LaTex] Over wide figure with caption of the same width that both spill out of the right margin and are aligned flush left

captionsfloatshorizontal alignment

This question is similar to that question, but instead I want to place a figure caption flush left aligned to an overwide figure so that it spills out of the right margin.

MWE

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage{float}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}
\captionsetup[figure]{width=1.2\textwidth}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
  \includegraphics[draft,width=1.2\textwidth]{Figures/foo.pdf}%
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{figure}

\lipsum[120]

\end{document}

What I want is this:

Result

Best Answer

The width= setting of the caption package will always center its caption with respect to the \textwidth, so width=1.2\textwidth will give you infact a left and right margin of -0.1\textwidth.

For manipulating its margins, better use margin= instead, since it offers discrete values for left and right margin. For example:

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}

% uncomment this if the setting should affect all figures
%\captionsetup[figure]{margin={0pt,-0.2\textwidth}}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
  \includegraphics[draft,width=1.2\textwidth]{Figures/foo.pdf}%
  \captionsetup{margin={0pt,-0.2\textwidth}}% only for this figure
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{figure}

\lipsum[120]

\end{document}

As an alternative, one could put the whole figure contents inside a minipage with the desired width, this way both the content and the caption will be adjusted to the new width:

\documentclass{scrartcl} % KOMA-Script article
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{graphicx}\graphicspath{Figures}
\usepackage[format=plain,justification=raggedright,font={small}]{caption}

\begin{document} 

\lipsum[120]
\begin{figure}[thbp]
\begin{minipage}{1.2\textwidth}
  \includegraphics[draft,width=\textwidth]{Figures/foo.pdf}%
  \caption{Caption that has the same width as the figure, but should be aligned to the left as everything else, but should spill out of the right margin}
  \label{fig:key}
\end{minipage}
\end{figure}

\lipsum[120]

\end{document}

Both should give identical results:

enter image description here

Related Question