Skip to content

不能正确显示页眉 #14

@ZXYSDP

Description

@ZXYSDP

#let mainmatter( // documentclass 传入参数 twoside: false, fonts: (:), // 其他参数 ... // 页眉 header-render: auto, header-vspace: 0em, display-header: true, skip-on-first-level: false,/ ... ..args, it,
将以上两个参数改成true和false后,报错unexpected argument
mainmatter中页眉部分,loc参数
let first-level-heading = if not twoside or calc.rem(loc.page(), 2) == 0 { heading-display(active-heading(level: 1, loc)) } else { "" } let second-level-heading = if not twoside or calc.rem(loc.page(), 2) == 2 { heading-display(active-heading(level: 2, prev: false, loc)) } else { "" }
之后删除这两个loc,报错context does not have field "body"
在custom-heading中
#let heading-display(it) = { if it != none { if it.has("numbering") and it.numbering != none { numbering(it.numbering, ..counter(heading).at(it.location())) [ ] } it.body } else { "" } }
去掉body后custom-heading报错unknown variable: loc
// 当前页面的标题 let cur-headings = query(selector(heading.where(level: level)).after(here())) .filter(it => it.location().page() == loc.page())
再把loc换成here()后mainmatter报错
pagebreaks are not allowed inside of containers
Hint: try using a `#colbreak()` instead

// 4.3 标题居中与自动换页 show heading: it => { if array-at(heading-pagebreak, it.level) { // 如果打上了 no-auto-pagebreak 标签,则不自动换页 if "label" not in it.fields() or str(it.label) != "no-auto-pagebreak" { pagebreak(weak: true) } } if array-at(heading-align, it.level) != auto { set align(array-at(heading-align, it.level)) it } else { it } }
中把pagebreak(weak: true)换成
colbreak(weak:true)
报错解决,但不知道是不是正常实现功能,只是按着提示改的

Environment

Typst 0.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions