Skip to content

Commit

Permalink
Migrating to Typst 0.13.0 (#10)
Browse files Browse the repository at this point in the history
* 📚 在 README 中添加 typst-cli 的安装命令

📚 更新 README 中关于引用格式的说明,澄清 CSL 文件的使用情况

📚 更新 README 中关于 Slides 模板的描述,强调其完全基于 touying-buaa 项目

📚 更新运行环境要求至 Typst 0.13.0

📚 在 README 中添加 GitHub Actions 的 PDF 输出链接

* ✨ 删除 main.typ 中的错别字

* ✨ 调整contents中 outline.entry 的生成逻辑,使其符合 typst 0.13.0

🎨 改进内容定位逻辑,使用 here() 替代 locate + 标签方法

✨ 在 contents.typ 中添加 v(-1em) 以调整内容布局
  • Loading branch information
Ri-Nai authored Feb 22, 2025
1 parent 6a31f08 commit 2b956cd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

![contrast](docs/assets/contrast.png)

可以在 [GitHub Actions](https://github.com/Ri-Nai/BIT-Typst-Template/actions/workflows/build.yml) 中查看最新的 PDF 输出。

<!-- 或者在 [Releases](https://github.com/Ri-Nai/BIT-Typst-Template/releases) 中下载 -->

> [!CAUTION]
> 本模板不保证完全符合学校要求,使用时请自行检查是否符合。 <br>
> 本人目前就读大二,对毕业设计了解有限,模板为个人制作,可能存在不准确之处。 <br>
Expand All @@ -23,7 +27,7 @@
### 🛠️ 运行环境

💻 Typst 0.12.0
💻 Typst 0.13.0

### 🚀 使用方法

Expand Down
11 changes: 5 additions & 6 deletions undergraduate-thesis-template/main.typ
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,11 @@ $
columns: 10,
[1],
..range(2, n + 1).map(x => table.cell(
fill: if range(2, calc.floor(calc.sqrt(x)) + 1).all(y => calc.rem-euclid(x, y) != 0) {
luma(200)
},
str(x),
),
)),
fill: if range(2, calc.floor(calc.sqrt(x)) + 1).all(y => calc.rem-euclid(x, y) != 0) {
luma(200)
},
str(x),
))
),
)
]
Expand Down
30 changes: 16 additions & 14 deletions undergraduate-thesis-template/pages/contents.typ
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
#import "../utils/ziti.typ": zh, zihao

// inspired from 璜珀's blog https://blog.hpcesia.com/posts/5252cfe9/
// inspired from 璜珀's blog https://blog.hpcesia.com/posts/5252cfe9/
#let contents() = {
align(center)[
#v(0.6em)
#text(
size: zh("三号"),
font: "SimHei",
"目 录",
)<contents>
)
#v(1.8em)
]


context {
let contents-location = locate(<contents>)
let contents-location = here()
show outline.entry: it => {
let loc = it.element.location()
link(
loc,
it.body,
)
h(0.5em)
box(width: 1fr, it.fill)
let before = loc.position().page < contents-location.position().page
link(
loc,
numbering(
if before { "I" } else { "1" },
..counter(page).at(loc),
it.indented(
it.prefix(),
{
it.body()
h(0.5em)
box(width: 1fr, it.fill)
let before = loc.position().page < contents-location.position().page
numbering(
if before { "I" } else { "1" },
..counter(page).at(loc),
)
},
),
)
}

v(-1em)
outline(title: [], indent: 2em)
}
pagebreak()
Expand Down

0 comments on commit 2b956cd

Please sign in to comment.