1

I have a picture inside a wrapfigure that I wish to have alongside a section.

\documentclass{article}
\usepackage[english,french]{babel}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}

\begin{document}

\begin{wrapfigure}{r}{0.3\textwidth}
\includegraphics[width=\linewidth]{foo_picture.png}
\end{wrapfigure}

\section{Section title}

\lipsum[1-2]

\end{document}

enter image description here

Unfortunately, the picture only starts at the beginning of the paragraph, and I want its top to be at the top of the section's title:

enter image description here

How to achieve this? I only have found answers to have the picture alongside of the title, but not next to both the title and the paragraph.

1

Here is a simple example solution:

\setlength\intextsep{12pt}
\begin{wrapfigure}[16]{r}{0in}
  ...
\end{wrapfigure}
\vspace{-15pt} \leavevmode\section{Section title}

Here, \leavevmode overwrites the default effect of \section, which does not work with wrapfigure nicely. But \leavevmode effectively creates a box with some space above the title. The wrapfigure start position is anchored at the start of the box. To counter it, \vspace{-15pt} is to move up the box position by 15pt, while \setlength\intextsep{12pt} is to move down the figure relative to the box position by 12pt. Tweak these numbers to see their effects and adjust them if necessary.

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.