Skip to content

记录gb7714-bilingual并整理其它方法#139

Open
YDX-2147483647 wants to merge 4 commits intotypst-doc-cn:masterfrom
YDX-2147483647:bib
Open

记录gb7714-bilingual并整理其它方法#139
YDX-2147483647 wants to merge 4 commits intotypst-doc-cn:masterfrom
YDX-2147483647:bib

Conversation

@YDX-2147483647
Copy link
Member

@YDX-2147483647 YDX-2147483647 commented Feb 20, 2026

Resolves #130

预览:https://deploy-preview-139--luxury-mochi-9269a9.netlify.app/FAQ/bib-etal-lang.html#%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E8%8B%B1%E6%96%87%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%E4%B8%AD%E7%9A%84-%E7%AD%89

比较各方法的性能
$ hyperfine 'typst c min.typ - -f svg' 'typst c nju.typ - -f svg' 'typst c citext.typ - -f svg' 'typst c gb7.typ - -f svg'
Benchmark 1: typst c min.typ - -f svg
  Time (mean ± σ):      1.247 s ±  0.502 s    [User: 0.568 s, System: 0.576 s]
  Range (min … max):    0.795 s …  2.566 s    10 runs

Benchmark 2: typst c nju.typ - -f svg
  Time (mean ± σ):      1.226 s ±  0.116 s    [User: 0.578 s, System: 0.609 s]
  Range (min … max):    1.012 s …  1.367 s    10 runs

Benchmark 3: typst c citext.typ - -f svg
  Time (mean ± σ):     13.944 s ±  3.895 s    [User: 12.239 s, System: 0.723 s]
  Range (min … max):    9.912 s … 20.744 s    10 runs

Benchmark 4: typst c gb7.typ - -f svg
  Time (mean ± σ):      1.985 s ±  0.841 s    [User: 0.832 s, System: 0.951 s]
  Range (min … max):    1.077 s …  3.195 s    10 runs

Summary
  typst c nju.typ - -f svg ran
    1.02 ± 0.42 times faster than typst c min.typ - -f svg
    1.62 ± 0.70 times faster than typst c gb7.typ - -f svg
   11.38 ± 3.35 times faster than typst c citext.typ - -f svg

{nju,citext,gb7}.typ就是那三个“完整测试例子”,min.typ是把nju.typ简化到Typst内置方式。

另外,据 https://github.com/Shuenhoy 反映,有时候gb7714-bilingual反而比原生还快。

@netlify
Copy link

netlify bot commented Feb 20, 2026

Deploy Preview for luxury-mochi-9269a9 ready!

Name Link
🔨 Latest commit 9a6ad8f
🔍 Latest deploy log https://app.netlify.com/projects/luxury-mochi-9269a9/deploys/699b0ce359f8990008305fbf
😎 Deploy Preview https://deploy-preview-139--luxury-mochi-9269a9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds documentation for the gb7714-bilingual package as a third method to fix the "et al." language issue in Chinese/English mixed bibliographies. It also introduces infrastructure to install local Typst packages (specifically citext) for testing the documented solutions.

Changes:

  • Added a new shell script to install citext as a local package for use in documentation examples
  • Integrated the installation script into GitHub workflows and Netlify build process
  • Significantly expanded the FAQ documentation to comprehensively cover three methods for handling bilingual bibliography issues, including the newly documented gb7714-bilingual package

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/install-typst-local-packages.sh New script to download and install citext v0.4.0 as a local package for documentation examples
netlify.toml Added call to install-typst-local-packages.sh in the build command
.github/workflows/check.yml Added step to run install-typst-local-packages.sh before building
.github/workflows/build.yml Added step to run install-typst-local-packages.sh before building
docs/FAQ/bib-etal-lang.md Extensively expanded documentation to cover three methods (character replacement, citext, and gb7714-bilingual) with detailed pros/cons, examples, and technical explanations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@YDX-2147483647 YDX-2147483647 force-pushed the bib branch 5 times, most recently from db6c324 to 73aa5fc Compare February 20, 2026 17:52
@YDX-2147483647 YDX-2147483647 changed the title 记录gb7714-bilingual 记录gb7714-bilingual并整理其它方法 Feb 20, 2026
@YDX-2147483647 YDX-2147483647 marked this pull request as ready for review February 20, 2026 18:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@YDX-2147483647
Copy link
Member Author

YDX-2147483647 commented Feb 21, 2026

@lucifer1004@Shuenhoy,过年好!这个 PR 涉及你们做的项目,而且包含比较主观的评价。如果最近一两周有空,欢迎审核!

具体操作建议:

  • 建议先看 netlify 预览页面而非文件 diff。因为文件 diff 比较杂,且有 VitePress 的 markdown 扩展语法,恐怕不太好看,可以后看或忽略。
  • 如果有修改建议,最好评论到这个 PR 下;不方便的话,发那个QQ群也可以。
  • 如果使用 GitHub 的审核功能,在各个文件评论完后,记得 Finish your review(那个界面会让选 Request changes、Approve之类的),不然评论只有自己能看到,其他人没有任何提示。(我就被坑过……)


更多细节请阅读 [gb7714-bilingual – Typst Universe](https://typst.app/universe/package/gb7714-bilingual)。

另外还可使用同作者开发的 [citrus](https://typst.app/universe/package/citrus)(又名 citeproc-typst),原理相同,支持一般 CSL,但因为代码逻辑更复杂而性能相对低下。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

citrus 的原理并不相同。
gb7714-bilingual 是手工实现规则;citrus 是完整解析 CSL 宏,通过实际运行宏来渲染引用和文献列表。

Copy link
Member Author

@YDX-2147483647 YDX-2147483647 Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有道理;那说“原理类似,支持一般CSL”可以吗?或者怎么表达?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉 Citrus 需要单开一个 section,因为是唯一一个真正在 Typst 内部实现 CSL macro expansion 的解决方案。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

唔,这则FAQ的目的是解决“等”“et al.”问题。如果我理解得没问题,对于国标样式,citrus相对gb7714-bilingual没有优势?若确实如此,那我认为citrus在FAQ不该专门列出;以后在 news 那边可以单独列。

这种方法简单快速,能覆盖大部分场景。
- **优点**
- 简单快速,能覆盖大部分场景
- 不会增加格式问题
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里和下面的“格式问题”指的是什么?

Copy link
Member Author

@YDX-2147483647 YDX-2147483647 Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“格式问题”指某处少个逗号、URL链接错误之类的细节。“不会增加格式问题”表示只会改正“等”“et al.”问题,不会导致其它地方出现新的问题。citext换了引擎和CSL,gb7714-bilingual换了整套实现方法,所以输出结果和原来没有任何关系,无法保证不增加格式问题。

之所以专门拿这一点出来说,是因为有时候会主动过拟合,比如把某段内容特意写到错误的字段。这种时候用modern-nju-thesis最保险。

这里举不出具体的“格式问题”,因为一旦举出来就能解决了,比如gb7714-bilingual那边的 pku-typst/gb7714-bilingual#8 (comment)pku-typst/gb7714-bilingual#1

你们觉得呢?需要删去这一点,还是怎么改呢?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“不会引入与依语言决定渲染无关的额外格式错误”之类的?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

记录gb7714-bilingual

4 participants