Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
template: add footnote
Browse files Browse the repository at this point in the history
  • Loading branch information
howardlau1999 committed Nov 11, 2023
1 parent 1f7bc4d commit b189c83
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
22 changes: 22 additions & 0 deletions chapters/ch01.typ
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,28 @@ Typst 中的标题使用 `=` 表示,其后跟着标题的内容。`=` 的数
]
)\

== 脚注

从 v0.4 版本开始,Typst 原生支持了脚注功能。本模板中,默认每一章节的脚注编号从 1 开始。

#table(
columns: (1fr, 1fr),
[
#set align(center)
代码
],
[
#set align(center)
渲染结果
],
```typ
Typst 支持添加脚注#footnote[这是一个脚注。]。
```,
[
Typst 支持添加脚注#footnote[这是一个脚注。]。
]
)\

== 图片

在 Typst 中插入图片的默认方式是 `image` 函数。如果需要给图片增加标题,或者在文章中引用图片,则需要将其放置在 `figure` 中,就像下面这样:
Expand Down
1 change: 1 addition & 0 deletions functions/numbering.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#let partcounter = counter("part")
#let chaptercounter = counter("chapter")
#let appendixcounter = counter("appendix")
#let footnotecounter = counter(footnote)
#let rawcounter = counter(figure.where(kind: "code"))
#let imagecounter = counter(figure.where(kind: image))
#let tablecounter = counter(figure.where(kind: table))
Expand Down
2 changes: 1 addition & 1 deletion functions/underline.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "../functions/style.typ": textbf

#let chineseunderline(s, width: 300pt, bold: false) = {
let chars = s.split("")
let chars = s.clusters()
let n = chars.len()
style(styles => {
let i = 0
Expand Down
3 changes: 2 additions & 1 deletion install_typst.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ $OutputEncoding = [System.Text.Encoding]::UTF8

# Check if Rust is already installed
if (Get-Command cargo -ErrorAction SilentlyContinue) {
Write-Output "检测到 Rust 已安装,跳过安装。"
Write-Output "检测到 Rust 已安装,尝试更新。"
rustup update
}
else {
# Download the installer
Expand Down
1 change: 1 addition & 0 deletions template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
if it.numbering != none {
chaptercounter.step()
}
footnotecounter.update(())
imagecounter.update(())
tablecounter.update(())
rawcounter.update(())
Expand Down

0 comments on commit b189c83

Please sign in to comment.