2

I'm trying to create a biography section for a list of authors am crammed for space. So when declaring the wrapfigure to provided text wrapping around each author's tessellated bio photo, I need to reduce the number of lines wrapped.

Here is a minimal example:

\documentclass[english]{article}

\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{babel}
\usepackage[pangram]{blindtext}

\begin{document}
\section*{Biography}

\begin{wrapfigure}[5]{L}{25mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Alpha} \Blindtext[1][13]

\begin{wrapfigure}[5]{R}{25mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Beta} \Blindtext[1][13]

\begin{wrapfigure}[5]{L}{25mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Gamma} \Blindtext[1][13]

\begin{wrapfigure}[5]{R}{25mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Delta} \Blindtext[1][13]

\end{document}

However it appears that the author images are not centered with the text wrap boundary. I would like to align the images at the top of the boundary to make the word wrapping as tight as possible.

enter image description here

2 Answers 2

5

As there are not floats, I suggest you the set of plain TeX macros provided by insbox, which does a better job in this case. It defines a \InsertBoxL{number of non-shortened lines at the beginning of the paragraph}{object inserted}[optional: number of supplementary shortened lines (in case TeX makes a wrong calculation of necessary sorter lines)] command, and a similar \InsertBoxR. I added an example code to fine-tune the vertical position of the inserted graphics, playing with the optional arguments of \raisebox:

\documentclass[english]{article}

\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{babel}
\usepackage[pangram]{blindtext}
\input{insbox}

\begin{document}
\section*{Biography}

\InsertBoxL{0}{\includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}}[-1]
\textbf{Author Alpha} \Blindtext[1][13]

\InsertBoxR{0}{\raisebox{0pt}[17.9mm]{\includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}}}[-1]
\textbf{Author Beta} \Blindtext[1][13]

\InsertBoxL{0}{\includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}}[-1]
\textbf{Author Gamma} \Blindtext[1][13]

\InsertBoxR{0}{\includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}}[-1]
\textbf{Author Delta} \Blindtext[1][13]

\end{document} 

enter image description here

4
  • This work for me as well, and is much cleaner. Although for my eventual case I still needed the other method to be able to tweak the vertical position. But TIL about insbox.
    – ruffsl
    Sep 16, 2017 at 0:14
  • 1
    @ruffsl: I slightly modified the code for inserting the second graphics, to show how the vertical position can be adjusted with the optional arguments of \raisebox.
    – Bernard
    Sep 16, 2017 at 0:40
  • This does not seem to work with itemize. Is there a workaround?
    – Pygmalion
    Jul 23, 2022 at 11:22
  • @Pygmalion: I've already seen it work with a list environment. Could you post a small complete code illustrating your problem?
    – Bernard
    Jul 23, 2022 at 12:03
1

I found a workaround, but it's not as robust or automated as I'd like, so am still looking for a better solution. By simply adding \vspace{-5mm} within the wrapfigure before the includegraphics, we can shift up the bio image's vertical alignment manually.

\documentclass[english]{article}

\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{babel}
\usepackage[pangram]{blindtext}

\begin{document}
\section*{Biography}

\begin{wrapfigure}[5]{L}{25mm}
    \vspace{-5mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Alpha} \Blindtext[1][13]

\begin{wrapfigure}[5]{R}{25mm}
    \vspace{-5mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Beta} \Blindtext[1][13]

\begin{wrapfigure}[5]{L}{25mm}
    \vspace{-5mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Gamma} \Blindtext[1][13]

\begin{wrapfigure}[5]{R}{25mm}
    \vspace{-5mm}
    \includegraphics[width=25mm,height=25mm,keepaspectratio]{example-image}
\end{wrapfigure}
\textbf{Author Delta} \Blindtext[1][13]

\end{document}

enter image description here

1
  • unfortunately, that is exactly the standard procedure with the current implementation of the wrapfigure package, afaik. it's just not a very good/clean (in terms of TeX layout automation) solution, since this vspace will vary for each picture with caption and even then, it doesn't always work. for pictures of the same dimensions with no caption, it's a passable solution, though.
    – thymaro
    Jul 24, 2018 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .