1

This is a MWE of what I'm trying to accomplish:

\documentclass[letterpaper,12pt]{article}

\usepackage{blindtext}
\usepackage{graphicx,wrapfig}

\usepackage{geometry}
\geometry{margin=2cm}

\begin{document}
    \begin{wrapfigure}{r}{3.1cm}
        \centering
        \includegraphics[width=3cm]{example-image}
    \end{wrapfigure}

    \section{A section}

    \blindtext
\end{document}

Which produces the following result:

Output of given LaTeX code.

That's nice, although I wanted to use the remaining space of the section, as it'll be short enough for a small image to be used.

I used wrapfigure (wrapfig package), but as @egreg stated here, it's not possible to put a wrapfigure before headings.

Is there another way to wrap text around an image, including headings?

Thanks in advance! :)

Update.- Here's a sketch of what I mean by wrapping the image with text, including the header:

Graphical explanation of what I'm trying to do

  • If you are certain there is sufficient space, you can use insbox as shown in my answer. However, this cannot cut into the text of the next section, so it is up to you to ensure there's enough space. – cfr Sep 11 '16 at 2:39
  • @cfr Ouch... Sounds difficult, but promising. Let me try it! – user101590 Sep 11 '16 at 3:43
  • Isn't that what the \vspace answer does? – cfr Sep 11 '16 at 21:44
  • @cfr Yeah, unfortunately I haven't found a way to also "move" the text so it could fill the blank space below the image. – user101590 Sep 11 '16 at 21:45
  • Can't you just remove the \baselineskip? I don't think that has anything to do with the \vspace solution, does it? – cfr Sep 11 '16 at 21:53
2

Just add \vspace{-...}:

\documentclass[letterpaper,12pt]{article}

\usepackage{blindtext}
\usepackage{graphicx,wrapfig}

\usepackage{geometry}
\geometry{margin=2cm}

\begin{document}

\begin{wrapfigure}{r}{3.1cm}
  \vspace{-1.5cm}
  \centering
  \includegraphics[width=3cm]{example-image}
\end{wrapfigure}

\section{A section}

\blindtext
\end{document}

enter image description here

| improve this answer | |
  • That's nice... But how can I "update" the configuration to fill the left space with text? Is that posible? – user101590 Sep 11 '16 at 5:57
  • @JBFWP286 Which left space do you mean? – cfr Sep 11 '16 at 13:45
  • @cfr The space next to the heading (the space left as blank, not explicitly at the left of, say, the heading). It's the one at the right, like in this answer. – user101590 Sep 11 '16 at 20:04
  • You mean you want text to the right of the header and the left of the image @JBFWP286 ? That would look very odd, wouldn't it? In any case, it has nothing to do with wrapping the image, really. That would be blank anyway. – cfr Sep 11 '16 at 20:07
  • @cfr Nope, I'm sorry I didn't explain myself correctly. I'll update my question to show you. – user101590 Sep 11 '16 at 21:36
2

I'm not sure I understand the objection to user94293's answer. If the problem is the vertical space underneath the picture, You can adjust it by removing some or all of the \baselineskip there.

For example,

\documentclass[letterpaper,12pt]{article}
\usepackage{blindtext}
\usepackage{graphicx,wrapfig}
\usepackage{geometry}
\geometry{margin=2cm}
\begin{document}
\section{A section}

\begin{wrapfigure}{r}{3cm}
  \vspace{-1.5cm}%
  \includegraphics[width=\linewidth]{example-image}
  \vskip -\baselineskip
\end{wrapfigure}
\blindtext
\end{document}

less space

| improve this answer | |
  • Interesting approach. Unfortunately, I can't choose both answers. They are so useful! :( – user101590 Sep 11 '16 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy