0

Combining lists and text wrapping around figures is a hassle. The wrapfig package, for example, cannot do it. I am now trying to use a \tcbsidebyside box with blanker option to achieve it.

The question is: Is there a clean way to exactly align the baseline of the first line on the left-hand side to the surrounding baseline? In the MNWE below, I would like to get the first line inside the box to align with enumerate label.

\documentclass{article}

\usepackage[most]{tcolorbox}
\usepackage{blindtext}

\begin{document}

\begin{enumerate}
\item First item
\item \tcbsidebyside[blanker, sidebyside adapt=right,
    halign upper=justify, halign lower=right, 
    sidebyside align=top seam]{\blindtext}{<Some image>}
\end{enumerate}

\end{document}

enter image description here

  • Perhaps you should rather use something like \tcbitemize – user31729 Nov 26 '17 at 17:19
  • I don't see how this would help me. – I would like to get a wrapped figure inside a list, rather than a list inside a box. – FlorianL Nov 27 '17 at 18:34
1

You can do that with the plain TeX macro package insbox and the enumitem package: the latter lets you define the right margin of the list, and has a stop and resume functionality. The former defines \InsertBoxL and \InsertBoxR commands, which take two mandatory arguments: the number of untouched lines at the beginning of the following paragraph, before the box is inserted, and the object to be inserted. In addition an optional argument (to be given at the end) is the number of supplementary shorter lines, in case TeX computes a wrong number of short lines.

Example:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{blindtext}
\input{insbox}

\begin{document}

\InsertBoxR{4}{\fboxsep = 0pt\fbox{\includegraphics[width = 4cm]{lepursuit1}}}
\begin{enumerate}[rightmargin =4.5cm]
  \item First item
  \item \blindtext
\end{enumerate}
\begin{enumerate}[resume]
  \item \blindtext
\end{enumerate}

\end{document} 

enter image description here

  • Thanks, but this seems like quite a manual hack. I was hoping for a more elegant and generic solution... – FlorianL Nov 27 '17 at 18:35

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.