Graphics, Figures & Tableswrapping text including sectioning around image.

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

wrapping text including sectioning around image.

Post by AliceWonder »

Wrapping text around images including sectioning

What I want is image with text inclusing section titles wrapped around it.

Using parpic it almost works but is incorrect. To compile a minimal working example that I have below, you need an image of width 717 height 1076 named Lilly_4_.jpg

Code: Select all

\documentclass[a4paper,12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\title{foo}
\author{bar}

\usepackage{graphicx}
\usepackage{picins}

\usepackage{titlesec}
\titleformat{\section}
  {\normalfont\normalsize\bfseries}{\thesection}{1em}{}
  
\titlespacing*{\section}     {0pt}{0pt}{2.3ex plus .2ex}

\begin{document}

\maketitle

\chapter{The Most Dangerous Game}

\parpic[l]{\includegraphics[width=0.3\textwidth]{Lilly_4_.jpg}} %Width 717 Height 1076

\section*{You stumble into my room\ldots{}}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.

\end{document}
I'm using the titlesec package to redefine the parameters for the section command so that it won't have the undesired space abover it when used right after the picture.

It sort of works but there is extra space below the image before the text wraps all the way to the left.

I suspect the problem is that I am using picins in a way it is not intended, but how do I do what I want to do?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Re: wrapping text including sectioning around image.

Post by AliceWonder »

I tried using wrapfig instead of picins but it seems that if there is not existing \par content in a chapter before you invoke wrapfig, it reserves the space and text float around it but it doesn't load images or captions (pdflatex compiler)
Post Reply