How to put two images next to each other in one table row?

I wanted to make a cheat sheet for myself with my own notes, but I don’t fully understand the typst documentation.

I’m trying to achieve this:

And this is what I get:

In last line there should be + sign between two circles images, but there isn’t, and one circle is in lower line.

Typst code:

#set table(
  stroke: none,
)

#table(
  columns: (auto, 1fr),
  inset: 10pt,
  align: (center, right),
  [Front Punch],
  image("square-512-Flat-Playstation.svg", width: 4%),
  [Back Punch],
  image("triangle-512-Flat-Playstation.svg", width: 4%),
  [Front Kick],
  image("cross-512-Flat-Playstation.svg", width: 4%),
  [Back Kick],
  image("circle-512-flat-Playstation.svg", width: 4%),
  [Uppercut],
  image("circle-512-flat-Playstation.svg", width: 4%) + image("circle-512-flat-Playstation.svg", width: 4%),
)

Hey @Roland,

inside the argument list of table you are in code mode. There, the plus symbol is used to join elements together, in your case the two images. You can use a string (image(...) + " + " + image(...)) to show it.

The two images show up in separate lines because an image is a block-level element, to force them inline you have to wrap them in a box: box(image(...)).

Edit: added links to the relevant documentation sections

Can you please edit your code example and use a code block instead of a block quote?

```typst
your code
```

Thanks!

Thank you @floki. I edited original post to use code block.

I was able to use plus symbol, like you said, but still have problem with inline images.

It looks like this now:

And code:

#set table(
  stroke: none,
)

#table(
  columns: (auto, 1fr),
  inset: 10pt,
  align: (center, right),
  [Front Punch],
  image("square-512-Flat-Playstation.svg", width: 4%),
  [Back Punch],
  image("triangle-512-Flat-Playstation.svg", width: 4%),
  [Front Kick],
  image("cross-512-Flat-Playstation.svg", width: 4%),
  [Back Kick],
  image("circle-512-Flat-Playstation.svg", width: 4%),
  [Uppercut],
  box(image("d-pad-down.png", width: 4%) + " + " + image("triangle-512-Flat-Playstation.svg", width: 4%)),
  [Blade Slash],
  box(image("d-pad-left.png", width: 4%) + " + " + image("square-512-Flat-Playstation.svg", width: 4%)),
)

If i try add # symbol before box, I got this error:

[21:27:14] compiled with errors

error: the character `#` is not valid in code
   ┌─ opis.typ:23:2
   │
23 │   #box(image("d-pad-down.png", width: 4%) + " + " + image("triangle-512-Flat-Playstation.svg", width: 4%)),
   │   ^

error: the character `#` is not valid in code
   ┌─ opis.typ:25:2
   │
25 │   #box(image("d-pad-left.png", width: 4%) + " + " + image("square-512-Flat-Playstation.svg", width: 4%)),
   │   ^

I don’t know if I’m interpreting this correctly, but such an operation is not allowed in a table cell?

You nearly got it, the images need to be individually wrapped in a box.

#set table(
  stroke: none,
)

#table(
  columns: (auto, 1fr),
  inset: 10pt,
  align: (center, right),
  [Front Punch],
  image("square-512-Flat-Playstation.svg", width: 4%),
  [Back Punch],
  image("triangle-512-Flat-Playstation.svg", width: 4%),
  [Front Kick],
  image("cross-512-Flat-Playstation.svg", width: 4%),
  [Back Kick],
  image("circle-512-Flat-Playstation.svg", width: 4%),
  [Uppercut],
  box(image("d-pad-down.png", width: 4%)) + " + " + box(image("triangle-512-Flat-Playstation.svg", width: 4%)),
  [Blade Slash],
  box(image("d-pad-left.png", width: 4%)) + " + " + box(image("square-512-Flat-Playstation.svg", width: 4%)),
)

No need for to explicitly start code mode with # as you already started it with #table(...). You would only need it if you switched into content mode (square brackets) again e.g. you could also write:

...
[Uppercut],
[#box(image("d-pad-down.png", width: 4%)) + #box(image("triangle-512-Flat-Playstation.svg", width: 4%))],
...

Thanks for using code blocks :)

Thank you so much, it worked! I wish you a peaceful evening.