I am trying to write the supporting information of the paper by using typst
. The code is provided as follows.
However, the format of the outline is not consistent with figure captions, for example:
Figure 1:
in the outline, butFigure S1.
in the figure caption.- Normal font of
Figure 1:
in the outline, but bold in the figure caption. I want theFigure 1:
in the outline changed into a bold font as that in the figure caption.
Thanks for your help.
#set page("a4", margin: auto)
// Long and short captions for the outline
#let in-outline = state("in-outline", false)
#show outline: it => {
in-outline.update(true)
it
in-outline.update(false)
}
#let ffcaption(long, short) = context if in-outline.get() { short } else { long }
// table
#show table.cell.where(y: 0): strong
// Change figure caption from Figure 1: to *Figure 1.*
#show figure.caption: it => [
#text(weight: "bold")[
#it.supplement S#it.counter.display(it.numbering).
~]#it.body
]
// make tabel caption on the top
#show figure.where(
kind: table
): set figure.caption(position: top)
// outline for image and table
#outline(
target: figure.where(kind: image).or(figure.where(kind: table)),
)
// figure
#figure(
rect(height:6cm, width: 11cm, fill: red),
caption: ffcaption([A curious figure.], [Short1]),
) <fig1>
#figure(
rect(height:10cm, width: 5cm, fill: blue),
caption: ffcaption([A curious figure.], [Short2 for]),
) <fig2>
#figure(
table(
columns: 2,
stroke: (_, y) => (
top: if y <= 1 { 1pt } else { 0pt },
bottom: 1pt,
),
[*Amount*], [*Ingredient*],
[360g], [Baking flour],
[Drizzle], [Vanilla extract],
),
caption: ffcaption([a caption],[Table short]),
) <tbl1>
#figure(
table(
columns: 2,
stroke: (_, y) => (
top: if y <= 1 { 1pt } else { 0pt },
bottom: 1pt,
),
[*Amount*], [*Ingredient*],
[360g], [Baking flour],
),
caption: ffcaption([a caption with very very very much much long long long long of of of new new new text is o with out a n ew c],
[table, short2])
) <tbl2>