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.

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}
share|improve this question
    
Welcome to TeX.sx! Please complete your code snippet into a minimal working example (MWE). –  hpesoj626 Mar 31 '13 at 6:50

1 Answer 1

up vote 4 down vote accepted

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 figure, 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 figure. The indentation (shortening) of the text is the figure 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:

enter image description here

\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.

share|improve this answer
    
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. –  mangledorf Jan 20 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 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/… –  mangledorf Jan 20 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 at 17:54

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.