TransWikia.com

Wrapping text around a figure (under the hood)

TeX - LaTeX Asked on August 8, 2021

I have a question about some of the packages out there that are used to wrap text around figures. Not looking for help with code or anything, just want to understand how TeX can be told to do this, conceptually.

Based on my limited knowledge of TeX, here’s what I think might be happening: TeX creates a large vbox – with width equal to the margins of the page – to contain the image and text. It sets the height of the vbox equal to the height of the image, floats the image to either the left or right edge of the vbox container, and creates a second container, another vbox, to hold the text. The dimensions of this inner vbox are such its width, together with the width of the image is equal to the width of the outer vbox, and its height is equal to the height of the outer vbox. TeX then fills this inner box with as much of the text as it can, and when it can’t it considers the outer vbox container to be complete, and it resumes its normal box producing activities on a new line.

Is that roughly correct? Thanks.

Edit: I’m new to this forum. Is this a bad question?

One Answer

TeX has a concept called parshape, in which the length of every line in a paragraph is specified explicitly. The packages or routines that "wrap" figures depend on determining the shape/size of the insertion, and then specify the parshape that will accommodate the insertion.

Several articles using this technique have appeared in TUGboat, among them the following

These all describe techniques applied by plain TeX, but they may lead you to an understanding of how insets are implemented.

Correct answer by barbara beeton on August 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP