# Adjusting left/right margins of a wrapfig

Is there a (simple) way to adjust the white space to the left or right of a wrapfigure? I'd like to reduce the whitespace on the left side of a right-floated figure.

Adding \hspace moves the figure to the left, it doesn't move the caption:

\begin{wrapfigure}{r}[.25in]{.98in}
\vspace{-20pt}
\hspace{-.25in}
\centering
\includegraphics[width=.98in]{figure.pdf}
\caption{Caption}
\label{fig:looping}
\vspace{-6pt}
\end{wrapfigure}

-
Welcome to TeX.sx! Please complete your code snippet into a minimal working example (MWE). – hpesoj626 Mar 31 '13 at 6:50

## 1 Answer

The horizontal gap between the contents of the wrapfig environment and the surrounding paragraph text is \columnsep (from the wrapfig documentation, section 2 Sizing and optional overhang, p 3):

LaTeX will wrap surrounding text around the ﬁgure, leaving a gap of \intextsep at the top and bottom, and \columsep at the side, by producing a series of shortened text lines beside the ﬁgure. The indentation (shortening) of the text is the ﬁgure width plus \columnsep minus overhang (if any; see below).

Here's an example that shows the difference when setting \columnsep to 0pt, and leaving it as-is:

\documentclass{article}
\usepackage{wrapfig,graphicx,lipsum}% http://ctan.org/pkg/{wrapfig,graphicx,lipsum}
\begin{document}
\begingroup
\setlength{\columnsep}{0pt}%
\begin{wrapfigure}{r}{.98in}
\centering\includegraphics[width=\linewidth]{example-image-a}
\caption{Caption}\label{fig:looping1}
\end{wrapfigure}
\lipsum[1]
\endgroup

\begin{wrapfigure}{r}{.98in}
\centering\includegraphics[width=\linewidth]{example-image-a}
\caption{Caption}\label{fig:looping2}
\end{wrapfigure}
\lipsum[1]
\end{document}


Adjust this to your liking. Use scoping (\begingroup...\endgroup, or similar) to localize any changes.

Note that you can therefore also use \intextsep as your vertical adjustment, rather than fixed values.

-
Excellent, thanks! – srubin Mar 31 '13 at 7:07
Putting my wrapfigure inside the group (even without the setlength command) removes the margin entirely and the text just covers the image. – Alec Jacobson Jan 20 '14 at 17:48
@mangledorf: Don't leave a space between the wrapfigure environment and the subsequent paragraph. Check that you have the latest version of [wrapfig](ctan.org/pkg/wrapfig (3.6 according to CTAN). Also, it may be that your image has a faulty bounding box. It's not possible to guess what could cause that from what you mention. – Werner Jan 20 '14 at 17:51
@mangledorf, solution was to make sure my wrapped paragraph of text was inside the group and there was a blank line before \endgroup, See tex.stackexchange.com/questions/82647/… – Alec Jacobson Jan 20 '14 at 17:52
@mangledorf: Ahhh, a blank line signifies a paragraph break in (La)TeX, which \lipsum does inherently (unless you \usepackge[nopar]{lipsum}). – Werner Jan 20 '14 at 17:54