I have a problem with the wrapfig package. As you can see in the example below, the leading whitespace is causing the table reaching into the next subsection (it would overflow without the leading whitespace but anyway). How can I avoid this behavior?

Thanks for your help!

MWE:

```
\documentclass{article}
\usepackage{wrapfig,booktabs}
\begin{document}
The input that has to be provided to compute the time the passenger needs to reach his luggage consists of $n + 3$ lines. The first line describes $n$; is this number equal to zero, the input is finished. The following $n$ lines describe the coordinates of the single corners with the form $x\;y$. Afterwards, the coordinates of the passengers are described in the same format as well as the speed of the luggage and the passenger respectively. For this line, the input's format is $l\;p$ where $l$ represents the luggage's speed and $p$ the passenger's one. A possible input sequence is shown in Table \ref{tabular:inputSequence}.
\begin{wraptable}{r}{0pt}
\begin{tabular}{c|l}
\toprule
4 & Scenario I -- 4 corners \\
0 0 & first corner \\
0 10 & second corner \\
10 10 & third corner \\
10 0 & fourth corner \\
20 30 & passenger's coordinate \\
10 15 & speeds \\
0 & end of input sequence \\
\bottomrule
\end{tabular}
\caption{A possible input sequence}\label{tabular:inputSequence}
\end{wraptable}
\end{document}
```

## Best Answer

As @UlrikeFischer said when answering a similar question, there is a space of

`\intextsep`

inserted before every wrapfig. This is not seen at the start of a page where such vertical spaces disappear.`\intextsep`

is declared/defined by the latex format and it is used in floats which are inserted with "h" in the text. So if you set it globally to 0pt it will affect such floats too.The workaround here is to first save the current

`\intextsep`

, then, set it to a new value`0pt`

before a`wrapfig`

. Again, before floats, restore the original value,`\setlength{\intextsep}{\oldintextsep}`

.