Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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

share|improve this answer
add comment

The boxhandler package gives great flexibility for customizing captions to figures It will allow you to specify caption width independently of image width, center, left or right justify captions, indent caption with respect to the Figure x. label, etc.

However, I do not know how to momentarily extend the margin to the right beyond \textwidth as the previous answer said. Perhaps you could place the text on a minipage with a reduced width, while leaving the \textwidth of the document to that desired for the figure.

Here's an example:

\documentclass{article}
\usepackage{boxhandler}
\parindent 0in
\begin{document}

\begin{minipage}{3in}
Text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
\end{minipage}

\bxfigure[ht]{The caption by default will be indented with respect to
the figure label, as is shown here}{\fbox{\rule{0ex}{6ex}%
\makebox[\textwidth]{Image}}}

\begin{minipage}{3in}
Text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
\end{minipage}

\end{document}

Example

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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