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
{{ message }}
Repository navigation
Figure caption should always appear on the same page as the figure itself #2109
I've added a figure about a 3rd of the page's available height. The figure is added at the bottom of the page, but its caption is shown as the first line on the next page, which is ridiculous. I know that there are LaTeX packages that prevent some parts of the document to appear on different pages, but I thought that in Typst this is already enabled by default. Apparently not.
If the caption can't fit on the page, then the whole figure should be shown on the next page. One thing I don't know, is that what if the figure is so tall, that caption would never be able to appear on the same page. Maybe make an exception and only in this case place caption on the next page, or make a compiler error, that caption doesn't fit or make a boolean switch that handles this separation rules.
I can't reproduce this. For me the whole figure including caption moves down a page if it gets too big.
Do you by any chance have set #show figure: set block(breakable: true) or something similar?
I couldn't get rid of the : in the caption, so I did this thing. But documentation doesn't say what is the default #show rule value for each element. So I probably guessed wrong. How to replicate the default look of the figure (for images)?
At least visually. I can't prevent the caption line from being wrapped in another implicit block, which is not there in the original source, so instead of a v(0.65em) I just set block(above: 0.65em)
I don't get why Typst have to complicate things with numbering. In the doc, it says to add it.numbering inside the display(). Shouldn't it be the default behavior? At least in this show rule:
@freundTech, thanks, I was using align and block the other way around, so I used block(width: 100%), but this is better.
One other thing that is strange, that block is by default breakable: true but in here I can remove breakable and it will still work the same (as default show rule; in my document). Maybe it works differently then I think.
I don't get why Typst have to complicate things with numbering. In the doc, it says to add it.numbering inside the display(). Shouldn't it be the default behavior? At least in this show rule:
Ok, one thing that I see is that I can override #set figure(numbering: "i") and then the display() will show different numbering style, but with display(it.numbering) it won't change the style. But this is a very rare example.
Activity
freundTech commentedon Sep 11, 2023
I can't reproduce this. For me the whole figure including caption moves down a page if it gets too big.
Do you by any chance have set
#show figure: set block(breakable: true)or something similar?Andrew15-5 commentedon Sep 11, 2023
Oh, yes, you can say that:
I couldn't get rid of the
:in the caption, so I did this thing. But documentation doesn't say what is the default#showrule value for each element. So I probably guessed wrong. How to replicate the default look of the figure (for images)?laurmaedje commentedon Sep 11, 2023
There is actually a section about this for figures here, but it suffers from the exact same problem. A block should be added there.
freundTech commentedon Sep 11, 2023
This show rule seems to exactly reproduce the built-in figures:
At least visually. I can't prevent the caption line from being wrapped in another implicit block, which is not there in the original source, so instead of a
v(0.65em)I just setblock(above: 0.65em)Andrew15-5 commentedon Sep 11, 2023
I don't get why Typst have to complicate things with numbering. In the doc, it says to add
it.numberinginside thedisplay(). Shouldn't it be the default behavior? At least in this show rule:@freundTech, thanks, I was using
alignandblockthe other way around, so I usedblock(width: 100%), but this is better.One other thing that is strange, that
blockis by defaultbreakable: truebut in here I can removebreakableand it will still work the same (as default show rule; in my document). Maybe it works differently then I think.Andrew15-5 commentedon Sep 11, 2023
Ok, one thing that I see is that I can override
#set figure(numbering: "i")and then thedisplay()will show different numbering style, but withdisplay(it.numbering)it won't change the style. But this is a very rare example.laurmaedje commentedon Sep 11, 2023
Counters and numbering aren't ideal yet. They will be improved at some point.