4

The text is slightly higher than the image when initially starting the sentence. I have tried using vspace or \ to lower the sentence. But it just moves the whole image down with the text. Is there some simple fix like a package i'am missing. If i were to start the wrapfig on a new page the problem is gone though.

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{subfig}
\numberwithin{figure}{section}
\usepackage{wrapfig}
\usepackage{refstyle}
\graphicspath{{F}}
\usepackage{pdfcolparallel}
\usepackage{booktabs}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{multirow}
\setlength{\parindent}{0pt}
\begin{document}



 \clearpage
\subsubsection{Stepped Nozzle}
bla blah blah

\begin{wrapfigure}{L}{0.45\textwidth}
\centering
\captionsetup{justification=centering}
    \includegraphics[scale=.6]{liggy}
    \caption{Ligament case}
\end{wrapfigure}

In figure 4.16, the stepped nozzle has produced a vast amount of ligaments on the bottom angle. 
\end{document}

Example of problem

6

This is governed by the \intextsep length. You can set it to zero to avoid the empty space above and below the wrapfig environment:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\setlength\intextsep{0pt}
\begin{wrapfigure}{l}{0.45\textwidth}
    \includegraphics[width=0.45\textwidth]{pic}
    \caption{Ligament case}
\end{wrapfigure}
\noindent\lipsum[1]
\end{document}

If you wish the change to stay local (which I would advise), you can wrap the \setlength, the wrapfig and the paragraph which is to be wrapped around the figure inside a group:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
{%
    \setlength\intextsep{0pt}
    \begin{wrapfigure}{l}{0.45\textwidth}
        \includegraphics[width=0.45\textwidth]{pic}
        \caption{Ligament case}
    \end{wrapfigure}
    \noindent\lipsum[1]%
}
\lipsum[2]
\end{document}

Lastly, you could also put a negative \vspace inside the wrapfig environment:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{wrapfigure}{l}{0.45\textwidth}
    \vspace{-\baselineskip}
    \includegraphics[width=0.45\textwidth]{pic}
    \caption{Ligament case}
\end{wrapfigure}
\noindent\lipsum[1]
\lipsum[2]
\end{document}

The caveat of this solution is that if the wrapfig is at the top of a new page, it will be shifted above the first line (so you need to remove the \vspace command). Also, it requires you to manually determine the appropriate amount by which to shift manually (\baselineskip is probably what you usually want though).

As a side note: I would generally not set \parindent to zero globally, unless you really want it to be zero everywhere, but instead use a \noindent before a paragraph which is not supposed to start with an indented line.

Edit:

Result for the second code snippet:

code result

EDIT 2:

The reason why you'd almost certainly want your changes to \intextsep to stay local is that it is a LaTeX length for governing float behavior, not something specific to wrapfig. As per Lamport in LaTeX - A Document Preparation System:

\intextsep The vertical space placed above and below a float that is put in the middle of the text with the h location option. It is a rubber length.

(p.200, Section C.9.1)

EDIT 3:

In response to user's comment, here's the code which produces the desired result for me when doing this multiple times:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
{%
    \setlength\intextsep{0pt}
    \begin{wrapfigure}{l}{0.45\textwidth}
        \includegraphics[width=0.45\textwidth]{pic}
        \caption{Ligament case}
    \end{wrapfigure}
    \noindent\lipsum[1]%
}

\lipsum[2]

{%
    \setlength\intextsep{0pt}
    \begin{wrapfigure}{l}{0.45\textwidth}
        \includegraphics[width=0.45\textwidth]{pic}
        \caption{Ligament case}
    \end{wrapfigure}
    \noindent\lipsum[1]%
}
\end{document}
  • Okay first of all thank you very much for solving my question so quickly. I tried adding another wrap fig below in order to show another example, so I copied the same code but line reappeared for the second wrap fig. I tried setting the \intextsep command again but I don't see any changes? – user Apr 20 '17 at 22:25
  • Okay just tried the \vspace{-\baselineskip} twice and its solved thankssss – user Apr 20 '17 at 22:30
  • @user In the second wrapfig, did you set \intextsep to zero also the second time (you need to set it to zero for each wrapfig if you put it inside {...})? Because it works for me if I do it like that. Specifically, if you're using the second code example, you need to copy everything from {% \setlength\intextsep{0pt ... wrapfig ... \noindent\lipsum[1]} (or whichever text you have instead of \lipsum, of course). I'm glad that the other way works for you though. – alpenwasser Apr 20 '17 at 22:41
  • @user I have added a code example with two wrapfigs which works for me. – alpenwasser Apr 20 '17 at 22:48
  • 1
    @alpenwasser That has already been done, however it didn't solve the issue :( I summarised all related questions in my own question tex.stackexchange.com/questions/415398/… – Emera Jade Feb 16 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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