Fix Chinese text vertical offset after lists using baseline adjustment#13
Fix Chinese text vertical offset after lists using baseline adjustment#13
Conversation
…with [] in empty-par() Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
|
@copilot Hi, please revert your change. It is causing a lot of indent issues in the generated PDF. We should think of other solutions. Could you please try adjusting the v(-1.2em) to v(-1em)? |
Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Reverted the change and adjusted |
…nese text offset Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Reverted all changes and implemented the custom list rendering approach suggested by the user in #8. The implementation uses |
|
@copilot Run typst compile init-files/main.typ thesis.pdf --root . --font-path ./fonts typst compile init-files/main.typ thesis.pdf --root . --font-path ./fonts shell: /usr/bin/bash -e {0} downloading @preview/i-figured:0.2.2 1.9 KiB / 1.9 KiB (100 %) 1.9 KiB/s in 5.86 µs ETA: 0 s downloading @preview/tablex:0.0.9 46.9 KiB / 46.9 KiB (100 %) 46.9 KiB/s in 2.24 ms ETA: 0 s downloading @preview/algo:0.3.5 10.2 KiB / 10.2 KiB (100 %) 10.2 KiB/s in 1.29 ms ETA: 0 s error: item does not have field "marker" ┌─ paddling-tongji-thesis/tongjithesis.typ:93:13 │ 93 │ #child.marker │ ^^^^^^ help: error occurred while applying show rule to this list ┌─ init-files/sections/02_math.typ:85:0 │ 85 │ ╭ - 在其中,Typst 仍然处于 86 │ │ “数学模式”。因此,你可以直接在其中编写数学公式,但需要使用 It seems user's suggestion is not valid any more. Let's revert all changes again... |
…ese text offset Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
…red by ctyp Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Co-authored-by: RizhongLin <59563695+RizhongLin@users.noreply.github.com>
Examined the ctyp package and found their solution uses baseline adjustment ( |
对该 PR 的总结
text(baseline: -0.15em, box())调整基线位置,补偿中文字体度量差异该 PR 的成功合入是否需要关闭一些 Issue?
Close #8
该 PR 的功能展示
问题: 中文字符在列表后出现向下偏移,如图所示:
修复:
通过基线调整方法,补偿中文字体与西文字体之间的度量差异,从而解决列表后中文文本偏移问题。
技术细节:
src/utils/enumitem.typ:73)-0.15em的基线偏移来补偿中文字体度量差异vertical-adjustment和list-baseline-adjustment提高可维护性empty-par()函数不变box()以避免缩进问题影响范围: 此修改仅影响列表和枚举后的间距,不影响其他使用
empty-par()的元素(标题、图表、公式等)该 PR 的其他信息
[]替代box()导致缩进问题 ❌v(-1.2em)到v(-1em)效果不理想 ❌child.marker字段不存在而失败 ❌Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.