[Tex/LaTex] floatflt – removing extra white space on top

floatsspacingwrap

When I include a figure via floatfigure into my text, I can't get it to stick to the top margin of the text body. There is always some white space left. I even tried to look in the package code, but didn't find any clues to where it comes from. How can I chop it off?

MWE:

\documentclass[fontsize=11pt,russian,open=any]{scrbook}
\usepackage{cmap}
\usepackage[T2A]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage{fancyhdr} 
\usepackage[paperwidth=14.8cm, paperheight=21.0cm, top=1.1cm, bottom=1.8cm, twoside, inner=0.9cm, outer=1.8cm, bindingoffset=0.5cm, footskip=1cm, headsep=0cm, headheight=0cm, voffset=0cm, hoffset=0cm, marginparsep=0cm, marginparwidth=0cm]{geometry}
\usepackage[demo]{graphicx} 
\usepackage{color}
\usepackage{microtype} 
\usepackage{adjustbox}
\usepackage[leadingfraction=1.0]{savetrees}
\usepackage{showframe}
\usepackage{floatflt}

\renewcommand{\baselinestretch}{0.95} 

\setlength{\intextsep}{0pt} 
\setlength{\textfloatsep}{0pt}

\setlength{\parindent}{1.25em} 

\raggedbottom

\begin{document}

\begin{floatingfigure}[l]{0.45\linewidth}
\includegraphics[height=15\baselineskip, width=0.4\linewidth]{dummy}
\vspace{\baselineskip}
\end{floatingfigure}

--- Нет-нет! Одну! И левретку! Или болонку. Или мопса... Или вообще...

--- Мопса!!!~--- Серафима умудрилась вложить в название этой породы всю силу своего негодования и презрения.~--- Мопса!!!.. Черепашку ещё предложи!!! На верёвочке!!!

Царевич поёжился, ибо именно черепашка и не успела сорваться с его языка. 

--- А п-почему~--- <<на верёвочке>>?

--- Чтоб не убежала!!!.. Послушай, Иванушка. Почему мы не можем съездить в гости к Ярославне? Или в Вондерланд? Или просто на недельку поохотиться в лес?

--- Но десять дней назад мы же выезжали на охоту!~--- ухватился Иван за безопасную тему.

--- Выезжали!~--- снова упёрла руки в бока и стала похожа на маленькую, разгневанную букву <<Ф>> Серафима.~--- Если не принимать во внимание, что охотились \emph{вы}, а мне с \emph{боярышнями\/} пришлось всё это время просидеть в шатре на платочках, чтобы не обгореть на палящем сентябрьском солнце и не запачкать платье об траву, то конечно, выезжали!

\end{document}

enter image description here

Because I will always have to wrap multiple paragraphs around my figure, this package provided the only working solution.
If there are another approaches – I'll be glad to test them.

Best Answer

There are two issues in finding this spacing. The floatflt package places the figure on the current line but raised by 0.3\baselineskip. So initially all you need to do is add a \vspace{-0.7\baselineskip} at the beginning of the float to raise it one full baselineskip. However, at the top of the that is too much, as the base of the first line is essentially \topskip from the top of the text area, so we need to push the box down by 0.3\baselineskip and up by \topskip:

Sample output

\documentclass[fontsize=11pt,open=any]{scrbook}

\usepackage[demo]{graphicx} 
\usepackage{showframe}
\usepackage{floatflt}

\setlength{\figgutter}{0pt}

\raggedbottom

\usepackage{lipsum} %For dummy text

\begin{document}

\begin{floatingfigure}[l]{0.4\linewidth}%
  \vspace{\dimexpr0.3\baselineskip-\topskip}%
  \noindent
  \includegraphics[height=15\baselineskip,width=0.4\linewidth]{dummy}%
\end{floatingfigure}

\lipsum[1-5]
\end{document}

I have stripped out irrelevant packages from your code. Also the \intextsep and \textfloatsep play no role in floatflt. On the other hand there is \floatgutter which specifies the horizontal space between the float and the text. In your case, there was a paragraph indent before you figure, I cancelled this with \noindent.

Related Question