You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also noticed the lack of caption alignment. The new figure.caption still doesn't have it. Instead, I had to do this:
show figure.where(kind: table): fig => {
set figure.caption(position: top)
align(right, fig.caption)
align(center, fig.body)
}
Previously there was an "incident" where after making a custom show rule for the figure, the caption would be able to be typeset on a separate page from the body (#2109). But at least in my personal situation, the code above works fine.
Because the alignment isn't yet supported (in the set rules) for figures (and its caption) I think this should be a feature request. But it also should've been supported from the start so the bug also works, I suppose.
The fact that #show figure.caption: set align(left) doesn't work, is quite clearly a bug to me.
Oh yeah, I either forgot to test this one or I tested it, it didn't work, and I forgot about this. Anyway, yes, this doesn't work, unfortunately, but it clearly should (at least in v0.8).
It works when the caption is long enough, but if it's short then it's internally correctly aligned, but the whole figure block will be centered. Perhaps that's correct behaviour after all, not really sure.
Maybe a width property for figures could work. auto for the current behaviour and 100% to use all the available space (more space as the figure body requires), so the caption can align to the "real" left.
Left-aligned, hanging indent justified with the colon would be nice. But I think that's a bit complicated to achieve due to the varying numbering etc... Left align now seems to work nicely.
I may be misunderstanding something, but I think that even though this issue is closed the problem that @paulkre pointed out still remains in 0.12.0.
As @laurmaedje pointed out, setting #show figure.caption: set align(left) does work as expected. However, writing something like:
#figure(
image("figures/bird_flock.jpg", width: 90%),
caption:
[
#setalign(left)
This is a very long caption. This is a very long caption.
This is a very long caption. This is a very long caption.
This is a very long caption. This is a very long caption.
This is a very long caption. This is a very long caption.
]
)
still results in misaligned supplement:
This is problematic for me because I only want to apply align(left) to only some of the figures (with long captions).
Are these two ways of setting align(left) equivalent?
This is actually working as intended here. It's simply not equivalent. But you can get what you want by using the rule I posted, but scoped to a code or content block containing the figure.
Activity
antonWetzel commentedon Jul 24, 2023
A (temporary) solution could be to overwrite the figure command.
Result
Command
Explanation
show figure: it => (...)itbox(width: 100%)[...]#align(center)[#it.body]#v(10pt, weak: true)#set align(left)and#set par(hanging-indent: 1cm, justify: true)#pad(x: 1cm)[...]#it.supplement#it.counter.display(it.numbering)#it.captionFull code for example
Notes
show figure: ...commandsAndrew15-5 commentedon Sep 14, 2023
I also noticed the lack of caption alignment. The new
figure.captionstill doesn't have it. Instead, I had to do this:Previously there was an "incident" where after making a custom show rule for the figure, the caption would be able to be typeset on a separate page from the body (#2109). But at least in my personal situation, the code above works fine.
Andrew15-5 commentedon Sep 14, 2023
Because the alignment isn't yet supported (in the set rules) for figures (and its caption) I think this should be a
feature request. But it also should've been supported from the start so thebugalso works, I suppose.laurmaedje commentedon Sep 14, 2023
The fact that
#show figure.caption: set align(left)doesn't work, is quite clearly a bug to me.Andrew15-5 commentedon Sep 14, 2023
Oh yeah, I either forgot to test this one or I tested it, it didn't work, and I forgot about this. Anyway, yes, this doesn't work, unfortunately, but it clearly should (at least in v0.8).
antonWetzel commentedon Sep 15, 2023
Sorry if I missunderstood something.
With
typst 0.8.0 (464dac8d)I think the aligment works.Result
Code
laurmaedje commentedon Sep 15, 2023
It works when the caption is long enough, but if it's short then it's internally correctly aligned, but the whole figure block will be centered. Perhaps that's correct behaviour after all, not really sure.
antonWetzel commentedon Sep 15, 2023
Maybe a
widthproperty for figures could work.autofor the current behaviour and100%to use all the available space (more space as the figure body requires), so the caption can align to the "real" left.laurmaedje commentedon Sep 15, 2023
#show figure: set block(width: 100%)should work. Similarly to#show figure: set block(breakable: true).[-]Figure caption alignment not customizable[/-][+]Alignment doesn't work in figure caption[/+]maxfreu commentedon Nov 29, 2023
Left-aligned, hanging indent justified with the colon would be nice. But I think that's a bit complicated to achieve due to the varying numbering etc... Left align now seems to work nicely.
laurmaedje commentedon May 28, 2024
#show figure.caption: set align(left)works as expected, so I'll close this.massanf commentedon Jan 18, 2025
I may be misunderstanding something, but I think that even though this issue is closed the problem that @paulkre pointed out still remains in
0.12.0.As @laurmaedje pointed out, setting
#show figure.caption: set align(left)does work as expected. However, writing something like:still results in misaligned supplement:
This is problematic for me because I only want to apply
align(left)to only some of the figures (with long captions).Are these two ways of setting
align(left)equivalent?laurmaedje commentedon Jan 18, 2025
This is actually working as intended here. It's simply not equivalent. But you can get what you want by using the rule I posted, but scoped to a code or content block containing the figure.
Mental-Inferno commentedon Jul 4, 2026
I am still getting this issue. However, adding a
#h(1fr)to the end of the caption worked as a stop gap fix.