Hello @quachpas , thanks for your reply, the type comparison may be just a warning. I paste all other parts now after removing some confidential texts of my company.
#let header = {
set text(size: 10pt)
v(1cm)
grid(
columns: 3,
[*classification*], [], [],
box(width: 1fr),
)
v(1em)
}
#set document(
title: "$title$",
author: "$author$",
date: none
)
#set par(
justify: false,
leading: 0.6em
)
#set text(
font: "Arimo",
size: 10pt
)
#show raw: set text(font: "Inconsolata")
#set heading(
numbering: "1.1 "
)
#show heading: set text(
font: "Arimo",
weight: "bold"
)
#show heading.where(
level: 1
): it => {
v(36pt, weak: true)
text(
font: "Arimo",
size: 24pt,
weight: "bold",
fill: navy,
it
)
v(12pt)
}
#show heading.where(
level: 2
): it => {
v(24pt, weak: true)
text(
font: "Arimo",
size: 14pt,
weight: "bold",
fill: black,
it
)
v(12pt)
}
#show link: it => {
if type(it.dest) == str {
set text(fill: aqua)
underline(it)
} else {
it
}
}
#show heading.where(
level: 3
): it => {
v(18pt, weak: true)
text(
font: "Arimo",
size: 12pt,
weight: "bold",
fill: black,
it
)
v(12pt)
}
#set figure(
supplement: none
)
#show figure: it => {
set align(left)
set table(
fill: (_, row) => if row == 0 { navy },
stroke: 0.5pt + gray
)
show table: jt => {
set align(left)
// Allow breaking before "_"
// This breaks Reqytify tags.
// show regex("_"): c => { sym.zws + c }
jt
}
show image: set align(left)
block(it)
}
#show figure.where(
kind: table
): set block(breakable: true)
#set figure.caption(
position: top
)
#show figure.caption: it => {
set align(left)
set text(
size: 8pt,
fill: aqua,
style: "italic"
)
it
}
#show outline.entry: it => {
set text(
size: 15pt,
fill: navy,
weight: "bold"
)
v(12pt, weak:true)
it
}
#let cover_page = {
set page(
paper: "a4",
margin: 0cm,
)
set text(
size: 10pt,
fill: black
)
box(
width: 100%,
inset: (x: 1.8cm, y: 1cm)
)
$if(title)$
box(
width: 100%,
inset: (x: 1.8cm, y: 1cm),
text(
34pt,
fill: navy,
upper(strong[$title$])
)
)
$endif$
$if(subtitle)$
box(
width: 100%,
inset: (x: 1.8cm),
text(
14pt,
weight: "bold",
[$subtitle$]
)
)
$endif$
}
#let table_of_contents = {
set outline(
depth: 3
)
show outline.entry: it => {
show regex("^([\d\.]+) "): it => {
box(width: 2cm, it)
}
let item(it, size, color) = {
return link(
it.element.location(),
text(
size: size,
fill: color,
weight: "bold",
(
it.prefix(),
it.body(),
[ #box(width: 1fr, it.fill) ],
it.page()
).join()
)
)
}
if (it.level == 1) {
v(4pt, weak:true)
item(it, 15pt, navy)
v(4pt, weak:true)
} else if (it.level == 2) {
v(2pt, weak:true)
item(it, 12pt, black)
v(2pt, weak:true)
} else {
v(0pt, weak:true)
item(it, 10pt, black)
v(0pt, weak:true)
}
}
outline()
pagebreak()
}
#let list_of_figures = context {
if query(figure.where(kind: image)) != () {
outline(title: [List of Figures], target: figure.where(kind: image))
pagebreak()
}
}
#let list_of_tables = context {
if query(figure.where(kind: table)) != query(figure.where(caption: none)) {
outline(title: [List of Tables], target: figure.where(kind: table))
pagebreak()
}
}
#let references = {
$if(bibliography)$
set heading(outlined: false)
block(
text(
size: 15pt,
fill: navy,
weight: "bold",
bibliography(
title: "Other Applicable Documents",
"$bibliography$"
)
)
)
pagebreak()
$endif$
}
#cover_page
#pagebreak()
#context {
let header_size = measure(header)
set page(
paper: "a4",
margin: (
x: 1.8cm,
top: header_size.height
),
header-ascent: 0%,
header: header
)
table_of_contents
list_of_figures
list_of_tables
references
[$body$]
}
The v spacing is still lost. BTW, I am using pandoc to execute typst, the input is just a simple .md markdown file. The ātitleā and other variables are passed from pandoc somehow, it works with pandoc but failed in the typst.app web editor.
Thanks a lot.