#let in-outline = state("in-outline", false)
#show outline: it => {
in-outline.update(true)
it
in-outline.update(false)
}
#let flex-caption(long, short) = context if in-outline.get() { short } else { long }
#let my_table = table(
columns: 1,
[#lorem(100)],[#lorem(100)],[#lorem(100)],[#lorem(100)],[#lorem(100)],[#lorem(100)],[#lorem(100)],[#lorem(100)])
#show figure: set block(breakable: true)
#context{
figure(
my_table, caption: flex-caption([This is the table caption], [This is the outline caption])
); <link_my_table>
}
@link_my_table
I want to label my_table and reference it. I’m also using flex-caption to generate different caption for outlines. The table is bound with #let because I want to wrap it across pages as suggested here. I can’t figure out where to place the label, is it even possible?
#figure(
context { my_table },
caption: flex-caption([This is the table caption], [This is the outline caption]),
)<link_my_table>
@link_my_table
Not sure if that helps as the previous posted solution works as well. EDIT: I guess be careful about not adding unnecessary line breaks if using the square brackets.
Hello, thanks for this alternative solution. flokl’s answer was helpful in general, because I didn’t know about the markup/code mode restriction, but yours also helps me to understand the flexibility we have in typst.
Yes I know, it is necessary though for something else outside the scope of this question. I didn’t want to complicate the question with all the details.