- Set first-line-indent: 0 on all TABLE styles in default/review docx templates to prevent table cells from inheriting Normal paragraph indentation. - Set default PDF template body first-line-indent to 2em (all: true). - Change default PDF bookmark depth from 1 to 2 in CLI and build_pdf. - Extend docx post-processing to copy Normal style typography from reference-doc, format headings/references, and handle BodyText paragraphs.
117 lines
2.8 KiB
Typst
117 lines
2.8 KiB
Typst
// 默认空模板 —— 基础排版 + 简洁样式 + 封面页 + 三线表
|
|
|
|
#let primary = rgb("#1F4E79")
|
|
#let accent = rgb("#3467A8")
|
|
#let light = rgb("#96A0AA")
|
|
#let rule-blue = accent.lighten(46%)
|
|
|
|
#let cover-page(title, subtitle, date) = {
|
|
page(margin: (top: 3cm, bottom: 3cm, left: 3cm, right: 3cm))[
|
|
#align(center + horizon)[
|
|
#v(2cm)
|
|
#text(size: 28pt, weight: "bold", fill: primary, title)
|
|
#if subtitle != none {
|
|
v(0.8cm)
|
|
text(size: 16pt, fill: accent, subtitle)
|
|
}
|
|
#if date != none {
|
|
v(2cm)
|
|
text(size: 12pt, fill: light, date)
|
|
}
|
|
]
|
|
]
|
|
}
|
|
|
|
#let three-line-table(..args) = {
|
|
let kwargs = args.named()
|
|
let children = args.pos()
|
|
|
|
let new_children = ()
|
|
let header_seen = false
|
|
|
|
for child in children {
|
|
if child.func() == table.header {
|
|
new_children.push(table.hline(stroke: 1.25pt + rule-blue))
|
|
new_children.push(child)
|
|
header_seen = true
|
|
} else if header_seen and child.func() == table.hline {
|
|
new_children.push(table.hline(stroke: 0.75pt + rule-blue))
|
|
header_seen = false
|
|
} else {
|
|
new_children.push(child)
|
|
}
|
|
}
|
|
new_children.push(table.hline(stroke: 1.25pt + rule-blue))
|
|
|
|
kwargs.stroke = none
|
|
kwargs.inset = (x: 8pt, y: 5pt)
|
|
|
|
table(..new_children, ..kwargs)
|
|
}
|
|
|
|
#let default(
|
|
title: none,
|
|
subtitle: none,
|
|
date: none,
|
|
body,
|
|
) = {
|
|
if title != none {
|
|
cover-page(title, subtitle, date)
|
|
pagebreak()
|
|
}
|
|
|
|
set page(
|
|
paper: "a4",
|
|
margin: (top: 2.5cm, bottom: 2.5cm, left: 2.5cm, right: 2.5cm),
|
|
footer: context {
|
|
align(center)[
|
|
#text(size: 9pt, fill: light)[
|
|
#counter(page).display("1")
|
|
]
|
|
]
|
|
},
|
|
)
|
|
|
|
set text(
|
|
font: (
|
|
"Cambria",
|
|
"PingFang SC",
|
|
"Helvetica Neue",
|
|
"Arial",
|
|
),
|
|
size: 11pt,
|
|
lang: "zh",
|
|
)
|
|
|
|
// Body rhythm: spacing > leading; first-line indent = 2em for Chinese paragraphs
|
|
set par(justify: true, leading: 0.78em, spacing: 1.12em, first-line-indent: (amount: 2em, all: true))
|
|
|
|
// List rhythm: spacing ≥ leading (0.78em), looser than line height for readability
|
|
set list(indent: 1.2em, body-indent: 0.45em, spacing: 0.90em)
|
|
set enum(indent: 1.2em, body-indent: 0.45em, spacing: 0.90em)
|
|
|
|
// Headings: slightly tighter than long-form (manual/textbook) because H1 is 16pt here
|
|
show heading.where(level: 1): it => {
|
|
v(1.15em)
|
|
text(size: 16pt, weight: "bold", fill: primary, it)
|
|
v(0.5em)
|
|
}
|
|
|
|
show heading.where(level: 2): it => {
|
|
v(0.9em)
|
|
text(size: 13pt, weight: "bold", fill: accent, it)
|
|
v(0.34em)
|
|
}
|
|
|
|
show heading.where(level: 3): it => {
|
|
v(0.62em)
|
|
text(size: 11pt, weight: "bold", fill: light, it)
|
|
v(0.24em)
|
|
}
|
|
|
|
set heading(numbering: none)
|
|
show link: it => text(fill: accent, it)
|
|
|
|
body
|
|
}
|