# Wrapfig / center text vertically

I need to wrap an image. There is a place where text is quite short. As a result, there is quite an important blanck, it is awful. I would need to "center vertically" my text. I can not find how to do that ...

Here is the MME

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{wrapfig}
\usepackage{xcolor}
\usepackage[]{graphicx}
\usepackage{duckuments}
\usepackage{lipsum}

\title{Essai_wrapfigure}
\author{Donald Duck}
\date{June 2018}

\begin{document}

\maketitle
\tableofcontents
\chapter{Hello}
\section{Introduction}
\begin{wrapfigure}[10]{L}{0.3\textwidth}
\includegraphics[width=0.25\textwidth]{example-image-duck}
\end{wrapfigure}
A quite short text, no more lines unfortunately. There are about 35 words. We won't add more. Life is beautiful when you don't speak useless. Sometimes, it is better not to write too much.
\vspace{100pt}
\WFclear
\section{Développement}
\begin{wrapfigure}[10]{L}{0.3\textwidth}
\includegraphics[width=0.25\textwidth]{example-image-duck}
\end{wrapfigure}
\lipsum[2-4]

\end{document}


And the result

the paragraph "A quite short text... too much" is not properly vertically centered. Is there a way to make it so ? Thanks for your help.

• Don't use wrapfig. Either use two minipages or a tabular (or similar e.g. coffins or something).
– cfr
Jun 28, 2018 at 2:24
• Off-topic: I think you to escape the underscore in the title to avoid a ! Missing \$ inserted error: \title{Essai\_wrapfigure}. Jun 28, 2018 at 2:25

This assumes that reserving 10\baselineskip for the figure was a mistake. Note, if ;you specify the width as 0pt it will use the width of the image (plus \columnsep).

The \parbox is designed to be the same height as the image, plus 2\intextsep minus \baselineskip. The \intextsep is added by wrapfig. The [t] aligns the top of the \parbox to where the text is supposed to go. The [c] centers the text inside the box. The \WFclear is needed since a \parbox only counts as one line of text.

Experiments with \fbox showed that this really is centering w.r.t. the image.

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{wrapfig}
\usepackage{xcolor}
\usepackage[]{graphicx}
\usepackage{duckuments}
\usepackage{lipsum}

\title{Essai wrapfigure}
\author{Donald Duck}
\date{June 2018}

\newsavebox{\mybox}

\begin{document}

\maketitle
\tableofcontents
\chapter{Hello}
\section{Introduction}\par
\savebox{\mybox}{\includegraphics[width=0.25\textwidth]{example-image-duck}}% measure height
\begin{wrapfigure}{L}{0.3\textwidth}
\usebox{\mybox}
\end{wrapfigure}
\noindent\parbox[t][\dimexpr \ht\mybox+2\intextsep-\baselineskip][c]{\linewidth}{\parindent=\bibindent
A quite short text, no more lines unfortunately. There are about 35 words. We won't add more. Life is beautiful when you don't speak useless. Sometimes, it is better not to write too much.}
\WFclear
\section{D\'eveloppement}% sorry, ascii here
\begin{wrapfigure}{L}{0.3\textwidth}
\includegraphics[width=0.25\textwidth]{example-image-duck}
\end{wrapfigure}
\lipsum[2-4]

\end{document}

• Thanks @JohnKormylo, it works very well ! So appreciated to have such a quick and efficient answer... Jun 28, 2018 at 12:57