[Tex/LaTex] Wrap figure vertical alignment of text

vertical alignmentwrapfigure

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

Best Answer

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}
Related Question