# Wrapping text around image in memoir document class

I am using the memoir document class and I want to wrap text around an image. The image should be on the left and the text beside it. This is my main syntax:

\documentclass[a4paper,oneside]{memoir}
\usepackage[inner=3cm,outer=3cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{wallpaper}
\usepackage{palatino}
\setlength{\parindent}{4em}
\usepackage[sorting=none]{biblatex}
\addbibresource{biblio.bib}
\usepackage{picinpar}
\makechapterstyle{custom}{%
\chapterstyle{default}
\def\chapterheadstart{}
}
\chapterstyle{custom}


For this image:

\newline
\begin{wrapfigure}
\includegraphics[scale=0.5]{image.png}
\end{wrapfigure}


I have tried to import the wrapfig package, but it produces errors for the whole document. Is there another way to simply wrap the text around?

Thanks!

• There is also the picins package, \hangindent, \parshape and \leftskip. It sort of depends on how many paragraphs and where the transitions occur. – John Kormylo Jul 13 '16 at 15:34
• Welcome to TeX SX! I don't see why it should, except perhaps a conflict with the very old (latex 2.09!) package picinpar, which you load. Could post a full code demonstrating the problem? – Bernard Jul 13 '16 at 15:37
• I'll add to @John Kormylo's list cutwin and the easy-to-use plain TeX set of macros insbox. – Bernard Jul 13 '16 at 15:40
• @JohnKormylo I have heard of \parshape, is there any syntax on how to use it? – user4476006 Jul 13 '16 at 15:46
• And I only have around 4 sentences that need to be wrapped, so should fit around the fairly small image. Which would be recommended in light of this? – user4476006 Jul 13 '16 at 15:47

## 1 Answer

Here is a demonstration for \hangindent for 4 lines. I deliberately started the image at the baseline and used an image smaller than the gap.

Note that wrapfigure normally adds a full \baselineskip above and below the image.

\documentclass[a4paper,oneside]{memoir}
\usepackage[inner=3cm,outer=3cm]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{wallpaper}
\usepackage{palatino}
\setlength{\parindent}{4em}
\usepackage[sorting=none]{biblatex}
\addbibresource{biblio.bib}
\usepackage{picinpar}
\makechapterstyle{custom}{%
\chapterstyle{default}
\def\chapterheadstart{}
}
\chapterstyle{custom}
\usepackage{lipsum}% generic text
\usepackage{wrapfig}% required for wrapfigure

\begin{document}

\lipsum[1]
\sbox0{\includegraphics[height=2.5\baselineskip]{example-image}}% measure image
\rlap{\raisebox{-\ht0}[0pt][0pt]{\usebox0}}\vspace{-\baselineskip}% overlay image
\hangindent=\dimexpr \wd0+\columnsep\relax
\hangafter=-4
\lipsum[2]
\begin{wrapfigure}{l}{0pt}
\usebox0
\end{wrapfigure}
\lipsum[3]
\end{document}


• Thank you. In your code, where would I actually put my text? My syntax: '\includegraphics[scale=0.5]{image} \textbf{Header} This is a sentence I was using....' – user4476006 Jul 13 '16 at 16:38
• Just replace \lipsum with the paragraph desired. – John Kormylo Jul 13 '16 at 16:42
• That hasn't worked... the image became too small and actually created two small images. – user4476006 Jul 13 '16 at 17:20
• You don't HAVE to use [height=2.5\baselineskip]. i did that to make the image fit in 4 lines of text. – John Kormylo Jul 13 '16 at 21:25
• Same OP, asked one day earlier. Duplicate? tex.stackexchange.com/questions/319341/… – Johannes_B Jan 29 '17 at 13:46