From cda086e4f141df048af526ed6b40164d6ccfe3e5 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Sat, 21 Feb 2026 01:36:04 +0800 Subject: [PATCH 1/5] build: move netlify build command into a script Also update typst from v0.14.1 to v0.14.2. --- netlify.toml | 23 +---------------------- scripts/netlify-build.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 scripts/netlify-build.sh diff --git a/netlify.toml b/netlify.toml index 80ece95..1ff2495 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,23 +1,2 @@ [build] -command = """ -curl -OL https://www.7-zip.org/a/7z2409-linux-x64.tar.xz && \ -tar -xvf 7z2409-linux-x64.tar.xz 7zz && \ -mv 7zz 7z && \ -\ -curl -OL https://github.com/typst/typst/releases/download/v0.14.1/typst-x86_64-unknown-linux-musl.tar.xz && \ -tar -xvf typst-x86_64-unknown-linux-musl.tar.xz && \ -mv typst-x86_64-unknown-linux-musl/typst typst && \ -rm -r typst-x86_64-unknown-linux-musl && \ -\ -curl -OL https://github.com/typst/typst/releases/download/v0.13.1/typst-x86_64-unknown-linux-musl.tar.xz && \ -tar -xvf typst-x86_64-unknown-linux-musl.tar.xz && \ -mv typst-x86_64-unknown-linux-musl/typst typst-0.13.1 && \ -rm -r typst-x86_64-unknown-linux-musl && \ -\ -export PATH=$PATH:$(pwd) && \ -\ -bash scripts/download-fonts.sh && \ -\ -pnpm install && \ -VP_PROFILE=netlify pnpm build -""" +command = "bash scripts/netlify-build.sh" diff --git a/scripts/netlify-build.sh b/scripts/netlify-build.sh new file mode 100644 index 0000000..97dd66a --- /dev/null +++ b/scripts/netlify-build.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euxo pipefail + +# Install 7z +curl -OL https://www.7-zip.org/a/7z2409-linux-x64.tar.xz +tar -xvf 7z2409-linux-x64.tar.xz 7zz +mv 7zz 7z + +# Install typst v0.14 +curl -OL https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-unknown-linux-musl.tar.xz +tar -xvf typst-x86_64-unknown-linux-musl.tar.xz +mv typst-x86_64-unknown-linux-musl/typst typst +rm -r typst-x86_64-unknown-linux-musl + +# Install typst v0.13 +curl -OL https://github.com/typst/typst/releases/download/v0.13.1/typst-x86_64-unknown-linux-musl.tar.xz +tar -xvf typst-x86_64-unknown-linux-musl.tar.xz +mv typst-x86_64-unknown-linux-musl/typst typst-0.13.1 +rm -r typst-x86_64-unknown-linux-musl + +# Complete installations +export PATH=$PATH:$(pwd) + +# Prepare +bash scripts/download-fonts.sh + +# Build +pnpm install +VP_PROFILE=netlify pnpm build From ce83c95eb91696a8d29531bb3bcc9d648774c560 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Fri, 20 Feb 2026 19:09:26 +0800 Subject: [PATCH 2/5] build: install citext as a local package --- .github/workflows/build.yml | 1 + .github/workflows/check.yml | 1 + scripts/install-typst-local-packages.sh | 20 ++++++++++++++++++++ scripts/netlify-build.sh | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 scripts/install-typst-local-packages.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2aeb86..0c3fecd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: - uses: typst-community/setup-typst@v4 with: typst-version: v0.14.2 + - run: bash scripts/install-typst-local-packages.sh - name: Restore cached fonts # Downloading fonts is time consuming. diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e7b8d1d..493fd83 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -32,6 +32,7 @@ jobs: - uses: typst-community/setup-typst@v4 with: typst-version: v0.14.2 + - run: bash scripts/install-typst-local-packages.sh - name: Restore cached fonts # Downloading fonts is time consuming. diff --git a/scripts/install-typst-local-packages.sh b/scripts/install-typst-local-packages.sh new file mode 100644 index 0000000..669faba --- /dev/null +++ b/scripts/install-typst-local-packages.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euxo pipefail + +TYPST_LOCAL="$(typst info --format json | jq '.packages["package-path"]' --raw-output)/local" + +WORKDIR="$(mktemp -d)" +pushd "$WORKDIR" + +# Install citext +curl -o citext.zip -L https://github.com/Shuenhoy/citext/archive/refs/tags/v0.4.0.zip +7z x citext.zip citext-0.4.0/package +sed -i 's/version = "0.3.1"/version = "0.4.0"/' citext-0.4.0/package/typst.toml # https://github.com/Shuenhoy/citext/issues/7 +mkdir -p "$TYPST_LOCAL/citext" +mv citext-0.4.0/package "$TYPST_LOCAL/citext/0.4.0" + +# Test citext +echo '#import "@local/citext:0.4.0"' | typst compile - test-citext.svg + +popd +rm -rf "$WORKDIR" diff --git a/scripts/netlify-build.sh b/scripts/netlify-build.sh index 97dd66a..b2dc457 100644 --- a/scripts/netlify-build.sh +++ b/scripts/netlify-build.sh @@ -6,6 +6,9 @@ curl -OL https://www.7-zip.org/a/7z2409-linux-x64.tar.xz tar -xvf 7z2409-linux-x64.tar.xz 7zz mv 7zz 7z +# Install jq +curl -o jq -L https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-linux-amd64 + # Install typst v0.14 curl -OL https://github.com/typst/typst/releases/download/v0.14.2/typst-x86_64-unknown-linux-musl.tar.xz tar -xvf typst-x86_64-unknown-linux-musl.tar.xz @@ -23,6 +26,7 @@ export PATH=$PATH:$(pwd) # Prepare bash scripts/download-fonts.sh +bash scripts/install-typst-local-packages.sh # Build pnpm install From 91d97900bd2d5056455252325d5baa903eb4afb0 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Sat, 21 Feb 2026 01:25:36 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95gb7714-bilingual=E5=B9=B6?= =?UTF-8?q?=E6=95=B4=E7=90=86=E5=85=B6=E5=AE=83=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/FAQ/bib-etal-lang.md | 216 +++++++++++++++++++++++++++++++++++--- 1 file changed, 203 insertions(+), 13 deletions(-) diff --git a/docs/FAQ/bib-etal-lang.md b/docs/FAQ/bib-etal-lang.md index 067d821..69b46f3 100644 --- a/docs/FAQ/bib-etal-lang.md +++ b/docs/FAQ/bib-etal-lang.md @@ -1,33 +1,115 @@ --- tags: bib +outline: [2, 3] --- # 如何修复英文参考文献中的“等”? -当中英文参考文献同时出现时,英文参考文献中的“等”应该是“et al.”,而不是“等”。 +著录多著者文献时可能省略部分作者,这时著录中文应加“等”,著录英文则应加“et al.”。然而目前 Typst 只支持用`#set text(lang: …)`统一选择“等”(`"zh"`)或“et al.”(`"en"`),不支持逐文献设置。 -## 法一:替换字符 +若需按文献语言自动选择“等”或“et al.”,主要有以下两类办法: + +- [**替换字符**](#modern-nju-thesis)——简单快速,推荐使用 + +- **替换参考文献引擎**——根治问题,但有其它缺点,具体有 [citext](#citext)、[gb7714-bilingual](#gb7714-bilingual) 等选择 + +本页会依次介绍这些方法;此外也可考虑[手动录入参考文献](./bibitem.md)。 + + + +## 法一:替换字符 {#modern-nju-thesis} 导入 [modern-nju-thesis](https://github.com/nju-lug/modern-nju-thesis) 的 `bilingual-bibliography` 函数,将英文参考文献中的`等`、`译`等汉字替换为英文。 ```typst no-render // 在文档开头引入 -#import "@preview/modern-nju-thesis:0.3.4": bilingual-bibliography +#import "@preview/modern-nju-thesis:0.4.0": bilingual-bibliography // 将原本的 #bibliography("refs.bib") 替换为 #bilingual-bibliography(bibliography: bibliography.with("refs.bib")) ``` -这种方法简单快速,能覆盖大部分场景。 +- **优点** + - 简单快速,能覆盖大部分场景 + - 不会增加格式问题,因为是在 Typst 内置机制的基础上修复 + - 性能不受影响,与 Typst 内置方式无明显差异 +- **缺点** + - 可能存在误判,毕竟本质上是几十行查找替换(例:[译者只有一个且名字包含逗号时,“tran(s)”单复数无法正确处理](https://github.com/nju-lug/modern-nju-thesis/blob/68f521d6ca28db02863f8841da08ed081044cf0c/utils/bilingual-bibliography.typ#L92)) + +::: details 完整测试例子 + +````typst +-- #set page(height: auto, width: 24em, margin: 1em) +#import "@preview/modern-nju-thesis:0.4.0": bilingual-bibliography + +- 中文@吴伟仁2017 +- 英文@su2025 + +#let bib = ```bib +@article{吴伟仁2017, + title = {软着陆任务设计}, + author = {{吴伟仁} and {王琼} and {唐玉华} and {于国斌} and {刘继忠} and {张玮} and {宁远明} and {卢亮亮}}, +} +@article{su2025, + title = {South {{Pole}}–{{Aitken}}}, + author = {Su, Bin and Chen, Yi and Wang, Zeling and Zhang, Di and Chen, Haojie and Gou, Sheng and Yue, Zongyu and Liu, Yanhong and Yuan, Jiangyan and Tang, Guoqiang and Guo, Shun and Li, Qiuli and Lin, Yang-Ting and Li, Xian-Hua and Wu, Fu-Yuan}, +} +```.text + +#bilingual-bibliography(bibliography: bibliography.with(bytes(bib))) +```` + +::: + +## 替换参考文献引擎 -## 法二:替换参考文献引擎 {#citext} +法一基于 Typst 内置的参考文献引擎,另一类方法是替换参考文献引擎,具体有 [citext](#citext)、[gb7714-bilingual](#gb7714-bilingual) 等选择。这类方法有如下共同特点。 -使用 [Citext](https://github.com/Shuenhoy/citext) 替换 Typst 默认的参考文献引擎[^citext-details]。 +- 共同**优点** + - 真正按文献语言自动切换渲染方式 +- 共同**缺点** + - 同一处引用多篇文献时,(因`show cite`规则限制)不能单纯`@key-a @key-b`,必须调用专门的`mulcite`或`multicite`函数 + - 对文字之外的格式支持不好(例:长URL折行时,链接异常) + - 不支持导出为 HTML(因为使用了`grid`、`hide`等语义弱的函数) + +### 法二:换用 citext {#citext} + +使用 [citext](https://github.com/Shuenhoy/citext) 替换 Typst 内置的参考文献引擎。 + +0. 安装 citext + + citext 未发布至 Typst Universe,需手动安装。具体有两种选择: + + - 单纯下载[仓库](https://github.com/Shuenhoy/citext),把`package/`文件夹保存为自己项目内的`./local-package/citext/`。 + - 按 [README 提示](https://github.com/Shuenhoy/citext?tab=readme-ov-file#install),安装为 local package。 + + 第一种方法相对简单,而且支持 typst.app 在线应用,可优先尝试。 1. 在文档开头引入 ```typst no-render - // citext 未发布至 Typst Universe,请手动将仓库下载至本地 #import "./local-package/citext/lib.typ": * + // 若安装为 local package,请将上一行替换为: + // #import "@local/citext:0.4.0": * #let bib = init-citation(read("refs.bib")) #show: show-extcite.with(bib: bib, gen-id: true) @@ -37,18 +119,126 @@ tags: bib ```typst no-render #show bibliography: none - #bibliography("refs.bib") // 与法一不同,法二需保留这行 + #bibliography("refs.bib") // 与其它方法不同,法二需保留这行 = 参考文献 #extbib(bib) ``` -这样可以真正实现按文献语言自动切换渲染方式;不过由于替换了引擎,会显著降低从零编译文档的速度,请在编写过程中妥善利用 Typst 的增量编译能力(`typst watch`/`tinymist preview`)。 +- **优点** + + - 真正按文献语言自动切换渲染方式 + + - 同时能解决其它文字格式问题 + + 因为 citext 使用了 [Zotero 中文社区维护的 CSL 样式](https://zotero-chinese.com/styles/GB-T-7714—2015(顺序编码,双语)/)和相关成熟技术栈,不会受 Typst 内置机制的各种缺陷影响。 + +- **缺点** + + - 性能很差 + + 由于替换了引擎,会显著降低从零编译文档的速度(从一秒慢到十几秒),请在编写过程中妥善利用 Typst 的增量编译能力(`typst watch`/`tinymist preview`)。 + + - 替换参考文献引擎的若干[共同缺点](#替换参考文献引擎) + +更多细节请阅读 [citext 的 README](https://github.com/Shuenhoy/citext)。 + +::: details citext 的技术栈 + +Typst 的参考文献样式采用 CSL 标准,但 CSL 无法描述如何按文献语言切换渲染方式。[CSL-M 扩展](https://citeproc-js.readthedocs.io/en/latest/csl-m/)增加了这一功能,但 Typst 所用参考文献引擎尚不支持。 + +citext 使用 [citation.js](https://citation.js.org/) + [QuickJS](https://crates.io/crates/rquickjs) + [WebAssembly](https://typst.app/docs/reference/foundations/plugin/) + [CtxJS](https://typst.app/universe/package/ctxjs) 替代了 Typst 原生的参考文献功能,从而可以通过 citation.js 调用 [citeproc-js](https://citeproc-js.readthedocs.io) 来支持 CSL-M。 + +::: + +::: details 完整测试例子 + +````typst +-- #set page(height: auto, width: 24em, margin: 1em) +#import "@local/citext:0.4.0": extbib, init-citation, show-extcite + +#let bib-content = ```bib +@article{吴伟仁2017, + title = {软着陆任务设计}, + author = {{吴伟仁} and {王琼} and {唐玉华} and {于国斌} and {刘继忠} and {张玮} and {宁远明} and {卢亮亮}}, + language = {zh}, +} +@article{su2025, + title = {South {{Pole}}–{{Aitken}}}, + author = {Su, Bin and Chen, Yi and Wang, Zeling and Zhang, Di and Chen, Haojie and Gou, Sheng and Yue, Zongyu and Liu, Yanhong and Yuan, Jiangyan and Tang, Guoqiang and Guo, Shun and Li, Qiuli and Lin, Yang-Ting and Li, Xian-Hua and Wu, Fu-Yuan}, + language = {en}, +} +```.text + +#let bib = init-citation(bib-content) +#show: show-extcite.with(bib: bib, gen-id: true) + +- 中文@吴伟仁2017 +- 英文@su2025 + +#show bibliography: none +#bibliography(bytes(bib-content)) + += 参考文献 +#extbib(bib) +```` + +::: + +### 法三:换用 gb7714-bilingual {#gb7714-bilingual} + +使用 [gb7714-bilingual](https://typst.app/universe/package/gb7714-bilingual) 替换 Typst 内置的参考文献引擎。 + +```typst no-render +// 在文档开头引入 +#import "@preview/gb7714-bilingual:0.2.1": init-gb7714, gb7714-bibliography +#show: init-gb7714.with(read("refs.bib"), style: "numeric", version: "2015") + +// 将原本的 #bibliography("refs.bib") 替换为 +#gb7714-bibliography() +``` + +- **优点** + + - 真正按文献语言自动切换渲染方式 + - 性能较好,仅略微慢于 Typst 内置方式,实用基本无感 + +- **缺点** + + - 可能增加其它文字格式问题,因为该引擎是2026年1月新开发的,尚不稳定 + - 替换参考文献引擎的若干[共同缺点](#替换参考文献引擎) + +更多细节请阅读 [gb7714-bilingual – Typst Universe](https://typst.app/universe/package/gb7714-bilingual)。 + +另外还可使用同作者开发的 [citrus](https://typst.app/universe/package/citrus)(又名 citeproc-typst),同样使用 Typst 重新实现参考文献引擎。与 gb7714-bilingual 相比,citrus 支持一般 CSL 而非局限于国标,不过因为代码逻辑更复杂而性能相对低下。 + + + +::: details 完整测试例子 + +````typst +-- #set page(height: auto, width: 24em, margin: 1em) +#import "@preview/gb7714-bilingual:0.2.1": gb7714-bibliography, init-gb7714 + +#let bib = ```bib +@article{吴伟仁2017, + title = {软着陆任务设计}, + author = {{吴伟仁} and {王琼} and {唐玉华} and {于国斌} and {刘继忠} and {张玮} and {宁远明} and {卢亮亮}}, +} +@article{su2025, + title = {South {{Pole}}–{{Aitken}}}, + author = {Su, Bin and Chen, Yi and Wang, Zeling and Zhang, Di and Chen, Haojie and Gou, Sheng and Yue, Zongyu and Liu, Yanhong and Yuan, Jiangyan and Tang, Guoqiang and Guo, Shun and Li, Qiuli and Lin, Yang-Ting and Li, Xian-Hua and Wu, Fu-Yuan}, +} +```.text + +#show: init-gb7714.with(bib, style: "numeric", version: "2015") -此外,同一处引用多篇文献时,不能单纯`@key-a @key-b`,需要调用专门的`mulcite`函数。更多细节请阅读 [Citext 的 README](https://github.com/Shuenhoy/citext)。 +- 中文@吴伟仁2017 +- 英文@su2025 -[^citext-details]: Typst 的参考文献样式采用 CSL 标准,但 CSL 无法描述如何按文献语言切换渲染方式。[CSL-M 扩展](https://citeproc-js.readthedocs.io/en/latest/csl-m/)增加了这一功能,但 Typst 所用参考文献引擎尚不支持。Citext 使用 [citation.js](https://citation.js.org/) + [QuickJS](https://crates.io/crates/rquickjs) + [WebAssembly](https://typst.app/docs/reference/foundations/plugin/) + [CtxJS](https://typst.app/universe/package/ctxjs) 替代了 Typst 原生的参考文献功能,从而可以通过 citation.js 调用 [citeproc-js](https://citeproc-js.readthedocs.io) 来支持 CSL-M。 +#gb7714-bibliography() +```` -## 法三:手动录入参考文献 + -请参考[手动参考文献方案](./bibitem.md)。 +::: From 65015db0d4606c2aa0c0a004fdec5426623a2037 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Sun, 22 Feb 2026 22:03:22 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AE=B0=E5=BD=95=20pku-typst/gb7714-bilin?= =?UTF-8?q?gual#10=20=E6=96=B0=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/FAQ/bib-etal-lang.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/FAQ/bib-etal-lang.md b/docs/FAQ/bib-etal-lang.md index 69b46f3..c418be4 100644 --- a/docs/FAQ/bib-etal-lang.md +++ b/docs/FAQ/bib-etal-lang.md @@ -88,9 +88,11 @@ BibTeX/BibLaTeX 有 language 和 langid 两个字段,以及 zh/en 和 chinese/ - 真正按文献语言自动切换渲染方式 - 共同**缺点** - 同一处引用多篇文献时,(因`show cite`规则限制)不能单纯`@key-a @key-b`,必须调用专门的`mulcite`或`multicite`函数 - - 对文字之外的格式支持不好(例:长URL折行时,链接异常) + - 对文字之外的格式支持不好(例:长URL折行时,链接可能异常[^url-link]) - 不支持导出为 HTML(因为使用了`grid`、`hide`等语义弱的函数) +[^url-link]: gb7714-bilingual 已经[基本修复了这一问题](https://github.com/pku-typst/gb7714-bilingual/pull/10),不过不如 [CSL](https://docs.citationstyles.org/en/v1.0.2/specification.html#appendix-vi-links) 和 [Hayagriva](https://github.com/typst/hayagriva/blob/a137441413a5907c15ced44d1502dfb9fa1a3014/src/csl/rendering/mod.rs#L89-L106) 全面。 + ### 法二:换用 citext {#citext} 使用 [citext](https://github.com/Shuenhoy/citext) 替换 Typst 内置的参考文献引擎。 @@ -191,7 +193,7 @@ citext 使用 [citation.js](https://citation.js.org/) + [QuickJS](https://crates ```typst no-render // 在文档开头引入 -#import "@preview/gb7714-bilingual:0.2.1": init-gb7714, gb7714-bibliography +#import "@preview/gb7714-bilingual:0.2.2": init-gb7714, gb7714-bibliography #show: init-gb7714.with(read("refs.bib"), style: "numeric", version: "2015") // 将原本的 #bibliography("refs.bib") 替换为 @@ -218,7 +220,7 @@ citext 使用 [citation.js](https://citation.js.org/) + [QuickJS](https://crates ````typst -- #set page(height: auto, width: 24em, margin: 1em) -#import "@preview/gb7714-bilingual:0.2.1": gb7714-bibliography, init-gb7714 +#import "@preview/gb7714-bilingual:0.2.2": gb7714-bibliography, init-gb7714 #let bib = ```bib @article{吴伟仁2017, From 326b6ba25b7ab8078103ca43e023373477090429 Mon Sep 17 00:00:00 2001 From: "Y.D.X." <73375426+YDX-2147483647@users.noreply.github.com> Date: Fri, 20 Mar 2026 22:10:34 +0800 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20update=20packages=20(citext=200.4.?= =?UTF-8?q?0=20=E2=86=92=200.5.0,=20modern-nju-thesis=200.4.0=20=E2=86=92?= =?UTF-8?q?=200.4.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/FAQ/bib-etal-lang.md | 8 ++++---- scripts/install-typst-local-packages.sh | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/FAQ/bib-etal-lang.md b/docs/FAQ/bib-etal-lang.md index c418be4..543f0ff 100644 --- a/docs/FAQ/bib-etal-lang.md +++ b/docs/FAQ/bib-etal-lang.md @@ -42,7 +42,7 @@ BibTeX/BibLaTeX 有 language 和 langid 两个字段,以及 zh/en 和 chinese/ ```typst no-render // 在文档开头引入 -#import "@preview/modern-nju-thesis:0.4.0": bilingual-bibliography +#import "@preview/modern-nju-thesis:0.4.1": bilingual-bibliography // 将原本的 #bibliography("refs.bib") 替换为 #bilingual-bibliography(bibliography: bibliography.with("refs.bib")) @@ -59,7 +59,7 @@ BibTeX/BibLaTeX 有 language 和 langid 两个字段,以及 zh/en 和 chinese/ ````typst -- #set page(height: auto, width: 24em, margin: 1em) -#import "@preview/modern-nju-thesis:0.4.0": bilingual-bibliography +#import "@preview/modern-nju-thesis:0.4.1": bilingual-bibliography - 中文@吴伟仁2017 - 英文@su2025 @@ -111,7 +111,7 @@ BibTeX/BibLaTeX 有 language 和 langid 两个字段,以及 zh/en 和 chinese/ ```typst no-render #import "./local-package/citext/lib.typ": * // 若安装为 local package,请将上一行替换为: - // #import "@local/citext:0.4.0": * + // #import "@local/citext:0.5.0": * #let bib = init-citation(read("refs.bib")) #show: show-extcite.with(bib: bib, gen-id: true) @@ -157,7 +157,7 @@ citext 使用 [citation.js](https://citation.js.org/) + [QuickJS](https://crates ````typst -- #set page(height: auto, width: 24em, margin: 1em) -#import "@local/citext:0.4.0": extbib, init-citation, show-extcite +#import "@local/citext:0.5.0": extbib, init-citation, show-extcite #let bib-content = ```bib @article{吴伟仁2017, diff --git a/scripts/install-typst-local-packages.sh b/scripts/install-typst-local-packages.sh index 669faba..fd9dd04 100644 --- a/scripts/install-typst-local-packages.sh +++ b/scripts/install-typst-local-packages.sh @@ -7,14 +7,13 @@ WORKDIR="$(mktemp -d)" pushd "$WORKDIR" # Install citext -curl -o citext.zip -L https://github.com/Shuenhoy/citext/archive/refs/tags/v0.4.0.zip -7z x citext.zip citext-0.4.0/package -sed -i 's/version = "0.3.1"/version = "0.4.0"/' citext-0.4.0/package/typst.toml # https://github.com/Shuenhoy/citext/issues/7 +curl -o citext.zip -L https://github.com/Shuenhoy/citext/archive/refs/tags/v0.5.0.zip +7z x citext.zip citext-0.5.0/package mkdir -p "$TYPST_LOCAL/citext" -mv citext-0.4.0/package "$TYPST_LOCAL/citext/0.4.0" +mv citext-0.5.0/package "$TYPST_LOCAL/citext/0.5.0" # Test citext -echo '#import "@local/citext:0.4.0"' | typst compile - test-citext.svg +echo '#import "@local/citext:0.5.0"' | typst compile - test-citext.svg popd rm -rf "$WORKDIR"