Tables: It is possible to inherit from 'set table' horizontal align only?

#set table(align: horizon + start)

// Works fine, but since `start` is already specified in `#set`,
// I would prefer to not specify it once again.
#figure(
  table(
    columns: 2,
    table.header([Monday], [Tuesday]),
    align: top + start,

    [
      - Lorem ipsum
      - Lorem ipsum dolor
    ],

    [
      - Lorem ipsum
      - Lorem ipsum dolor
      - Lorem ipsum
      - Lorem ipsum dolor
    ]
  )
)

At the top of the document, I have

#set table(align: horizon + start)

And then somewhere in the middle of the document I have a table for which I prefer to use align: top + start.

Is it possible to make it inherit start from set table instead of specifying it once again? I tried

align: top + auto

but this produces an error.

I’m fairly confident that for alignment you have to repeat both parts. It probably has to do with implicit defaults. Like when you write top it implicitly adds a default center. So, no, not possible. I might be wrong as I never faced this or haven’t faced enough to be 100% sure.

To be honest, I think this applies to any type. stroke has the same story: you can’t just make it 2em + yellow and then somewhere set it to red and expect it to also be 2em. Although I haven’t tried this with stroke as dictionary, maybe if you set (paint: blue, thickness: 4pt), then you can preserve (thickness: 4pt) by specifying just (paint: red).

1 Like

What you can do is access the current table.align value to make the new value. For this you need a context:

#set table(align: horizon + start)

#figure(
  context table(
    columns: 2,
    table.header([Monday], [Tuesday]),
    align: top + table.align.x,
    [
      - Lorem ipsum
      - Lorem ipsum dolor
    ],

    [
      - Lorem ipsum
      - Lorem ipsum dolor
      - Lorem ipsum
      - Lorem ipsum dolor
    ]
  )
)

@Andrew for stroke I just checked and it turns out each value is inherited! (see documentation here). For example:

#set line(length: 1cm, stroke: (paint: blue, thickness: 4pt))
#line()

#set line(stroke: red)
#line()

image

1 Like