Is there a way to have a figure next to text?

I am wondering whether it is possible to have a figure with text beside it, not sure how to achieve this. Currently, if I just write next to the image, I get a lot of white space. Not sure how to remove this/fill it in.

Images within text are not currently possible in TeXmacs. If you just want the figure and the text to lie side-by-side then you need to use a table with two column.

1 Like

No problem. The table setup seems to work perfectly!

Reopening this topic as I find myself in the same situation. I have a pretty simple picture that I would like to include as a figure and a paragraph coming along with it. I can dissociate them and put them block after block but having them in two columns would gain some space in an already long paper.

I have tried playing around with a one row / two columns table but wasn’t able to generate a satisfying result (the picture is always assumed to take the whole width of the document even after resizing it to the column). Is there a template document I could take a look at in order to get more familiar with this?

You can try to specify exact width for the table column. I think you can use something like 0.5par to specify half of the size of the current paragraph.

<\wide-tabular>
  <tformat|<cwith|1|1|1|-1|cell-width|0.45par>|<cwith|1|1|1|-1|cell-hmode|exact>|<table|<row|<\cell>
    \;
  </cell>|<\cell>
    \;
  </cell>>>>
</wide-tabular>

Hey. I figured out how to horizontally align the text of the table such that it looks like the text before it is continued (by removing all padding). However, inserting the table will create a line break before and after the table which makes it look separate from the text above and below. Can this space be removed? I’ve check for the units in the docs but couldn’t find anything that corresponds to the linebreak distance. My idea was to negatively pad the line break distance vertically. Any better options?

Thanks

Could you please post an example? I tried to reproduce what you describe but I did not get the vertical spacings.
To post the document, open it with a text editor, copy all and paste (inside a code block looks good).

Thanks for your help.

This is the simplified code

<TeXmacs|2.1.2>

<style|generic>

<\body>
  Text before.

  <tabular*|<tformat|<twith|table-vmode|exact>|<twith|table-width|1par>|<twith|table-hmode|exact>|<cwith|1|1|1|1|cell-hmode|exact>|<cwith|1|1|1|1|cell-width|0.5par>|<cwith|1|1|1|1|cell-hyphen|t>|<cwith|1|1|1|1|cell-valign|t>|<cwith|1|1|1|1|cell-lsep|0>|<cwith|1|1|1|1|cell-rsep|0>|<cwith|1|1|1|1|cell-tsep|0>|<cwith|1|1|1|1|cell-bsep|0>|<table|<row|<\cell>
    This is just some long long long long long long longlong longlong
    longlong longlong longlong longlong longlong longlong longlong longlong
    longlong longlong longlong longlong longlong longlong longlong longlong
    longlong longlong longlong longlong longlong longlong longlong longlong
    longlong long text.
  </cell>|<cell|<small-figure|<image|<tuple|<IMAGEDATA>|image>|0.05par|||>|>>>>>>

  This after.
</body>

<\initial>
  <\collection>
    <associate|page-medium|paper>
  </collection>
</initial>

<\references>
  <\collection>
    <associate|auto-1|<tuple|1|1>>
  </collection>
</references>

<\auxiliary>
  <\collection>
    <\associate|figure>
      <tuple|normal|<surround|<hidden-binding|<tuple>|1>||>|<pageref|auto-1>>
    </associate>
  </collection>
</auxiliary>

This is how it looks like. I would like to get rid of the line breaks before and after the table.

46

The following seems to work:

Text before.<next-line><tabular*|<tformat|<twith|table-vmode|exact>|<twith|table-width|1par>|<twith|table-hmode|exact>|<cwith|1|1|1|1|cell-hmode|exact>|<cwith|1|1|1|1|cell-width|0.5par>|<cwith|1|1|1|1|cell-hyphen|t>|<cwith|1|1|1|1|cell-valign|t>|<cwith|1|1|1|1|cell-lsep|0>|<cwith|1|1|1|1|cell-rsep|0>|<cwith|1|1|1|1|cell-tsep|0>|<cwith|1|1|1|1|cell-bsep|0>|<twith|table-lsep|0>|<twith|table-rsep|0>|<twith|table-tsep|0>|<twith|table-bsep|0em>|<cwith|1|1|1|1|cell-background|pastel
grey>|<table|<row|<\cell>
  This is just some long long long long long long longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  long text.
</cell>|<cell|<small-figure|<image|<tuple|<IMAGEDATA>|image>|0.05par|||>|>>>>>><next-line>This
after.

you have explicitly requested new paragraphs, this accounts for the spacing while you need to put all in the same paragraph and then use <next-line> to go to the line.

1 Like

Thanks. Looks way better. However, this no looks like the the gap between the first and second line (second line is the first in the table) is narrower than all others. Any Idea why this is and how it could be fixed?

Add some padding to the table:

Text before.<next-line><tabular*|<tformat|<twith|table-vmode|exact>|<twith|table-width|1par>|<twith|table-hmode|exact>|<cwith|1|1|1|1|cell-hmode|exact>|<cwith|1|1|1|1|cell-width|0.5par>|<cwith|1|1|1|1|cell-valign|t>|<cwith|1|1|1|1|cell-lsep|0>|<cwith|1|1|1|1|cell-rsep|0>|<cwith|1|1|1|1|cell-tsep|0>|<cwith|1|1|1|1|cell-bsep|0>|<twith|table-lsep|0>|<twith|table-rsep|0>|<cwith|1|1|2|2|cell-background|#a0a0a0>|<cwith|1|1|1|1|cell-hyphen|t>|<cwith|1|1|1|1|cell-background|>|<twith|table-tsep|0.2em>|<twith|table-bsep|0.2em>|<table|<row|<\cell>
  This is just some long long long long long long longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  longlong longlong longlong longlong longlong longlong longlong longlong
  long text.
</cell>|<cell|>>>>><next-line>This after.

Use the menu Focus->Padding when you are in the table. (change the top & bottom paddings, I have used 0.2em)

Thanks. Is there a way to figure out the exact padding necessary, i.e. the distance between two lines in a paragraph?

I’ve turned “text height correction” off in the cell properties and checked for the “interline space” in the format -> paragraph, which is “0.2fn” in my case. However, when i use this as padding it’s still not correct. Visually, something like “0.3fn” looks better. I’m wondering where that difference comes from and if i can get it to look exact. I want to use the table as a substitute for the missing feature of wrapping text around figures.

This is what I get. At this magnification, the vertical distance between the first and second line is about 208 pixels; the distance between the second and third about 211 pixels, the distance between the third and fourth about 205 pixels; all measured with kruler.
The table is on the third row and I left the text height correction to “both”.

Thanks for measuring it :slight_smile: It’s close but i’m wondering why there is no way to get the spacing similar to the spacing within a paragraph…