2

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.

Codoscope
  • 161
  • 2
    You can use manual vspace commands and shift it up. Be sure to reduce height (of the wrapfigure) at the same time. – TeXnician Sep 25 '17 at 12:15
  • 1
    See:https://tex.stackexchange.com/questions/390520/have-titlerule-not-overlap-wrapfigure/390544?s=1|0.0000#390544 – John Kormylo Sep 25 '17 at 14:48

1 Answers1

2

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.

Stefan Pinnow
  • 29,535
Chun Li
  • 121
  • 2