Can you wrap text around an image?

Is it possible in TeXmacs to insert an image (or table) and wrap text around it?

I can think of some “hacky” ways to achieve this, such as constructing a 2-cell table with the displayed image/table in one cell and the text in the adjacent adjacent cell, and reducing the padding so that the text in the second cell seems like it flows smoothly from inside the table to outside the table. However, this means carefully restructuring the text upon editing some of it to make it look right, which seems…well, anti-TeXmacs, sort of!

I feel like I’m missing something obvious! Does anyone know how to achieve this? I’m sure this is within TeXmacs’ capabilities one way or another!

1 Like

As far as I know it is not possible. I discussed it some time ago with @mgubi on the mailing list. I feel this is a good feature request.

1 Like

I wonder how TeX does this.

Those who understand TeX code (I do not) could find an answer in the code of the wrapfig package (https://ctan.org/pkg/wrapfig)

1 Like

I’m not an expert in TeX either, this is my understanding based on the document of wrapfig:

  1. Usually, the figure should be at the beginning of a paragraph (can be top left or top right), therefore Latex can calculate (from the figure height and line height) how many lines will be shortened by the figure width. TeX’s line breaking algorithm can typeset the paragraph given that information.
  2. User can put the figure in the middle of a paragraph, but she must carefully choose it to be at the position of the line break. Then I think it is similar to case 1.

You can see the examples in the document of wrapfig2: The wrapfig2 package (washington.edu)

1 Like

Currently it’s impossible in texmacs to wrap text around image. TeX uses \parshape to create hole in paragraph, with given number of lines needing shorten.

See also:

Hello, there is a workaround with a drawback.

If you select some paragraphs and the image positioned after those paragraphs and click Format -> Paragraph, then you can set the number of columns to 2 in the menu just for the selection. The drawback is that you will have to manually match the number of lines so that it looks right. I think LaTeX packages have the same drawback.

1 Like