2

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?

  • 2
    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. There have been some articles in TUGboat that show how this might be done in plain TeX. If you are interested, I can look them up. – barbara beeton Sep 10 at 0:54
  • @barbarabeeton Thanks so much! This is exactly what I was looking for. I am aware of \parshape, but it never occured to me that it could be used in that way. Would it at all be possible for you give me the link to one of these articles? – Harry Sep 10 at 6:33
3

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.

| improve this answer | |

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.