Reputation: 203
Some of my figures have long captions, which results in ugly outlines.
Is there a way to either truncate the outline.entry
text, set a maximum width for the text length or trigger a linebreak after N characters, such that the outline.entry
would compile to this:
I inspected the source and managed to modify the part after the section title with show outline.entry: set box(...)
but I couldn't figure out how to access what comes before the BoxElem
.
Upvotes: 0
Views: 147
Reputation: 1470
You can indeed construct your own outline.entry
show rule in typst instead of rust. The key ingredient is clip: true
on the box surrounding it.body
:
#show outline.entry: it => {
style(styles => {
let line-height = 1em
// "columns" width determines how much of the caption should show
grid(columns: (2fr, 1fr))[
#box(it.body, height: line-height, clip: true)
][
#box(width: 1fr, it.fill)
#box(it.page)
]
})
}
#outline(target: figure)
#figure(caption: [#lorem(150)])[
A figure
]
Upvotes: 0