werifu / HUST-typst-template

华科毕业论文(本科)的 typst 模板
MIT License
176 stars 17 forks source link

关于标题后分段 #1

Closed rqy2002 closed 1 year ago

rqy2002 commented 1 year ago

标题后不缩进问题应该可以通过

#show heading: it => it + parbreak()

解决,至少我实测如此 (归根结底,没缩进是因为标题和紧接着的文本间不会分段) 从qq空间来的x

werifu commented 1 year ago

为什么我试了下好像并没有用呢(

https://typst.app/project/wg6TydtrkSVYU7Q5B-UIeY

image
rqy2002 commented 1 year ago

我错了 :cry: 是 pagebreak() 可以换页。 不过这可能是 bug,我去typst问一问(

werifu commented 1 year ago

实际上官方说了这个现象: https://typst.app/docs/reference/layout/par/

first-line-indent The indent the first line of a paragraph should have. Only the first line of a consecutive paragraph will be intended (not the first one in a block or on the page).

所以我理解成是洋文的 feature 而不是 bug 了…

Icathian-Rain commented 1 year ago

标题后不缩进的问题,可以考虑将indent_par()直接加在heading后面(默认标题后面有一个宽度为缩进的盒子),这里box的宽度有待商榷。

#let indent_par() = {
  // 加上元素间间隔大概 2.0em 
  box(width: 1.5em)
}

show heading: it => {
    set text(weight: "bold", font: heiti, size: 12pt)
    pad(bottom: 1em, it)
  } + indent_par()

image

werifu commented 1 year ago

太棒了,已采用 dcebd7e

这样写正文就不突兀了