Skip to content

Typo in page setup guide #6492

@mewmew

Description

@mewmew

Description

There is a small typo in "Adapt headers and footers on pages with specific elements" of https://typst.app/docs/guides/page-setup-guide/

In particular, there is an unused page-counter variable and a trailing ), both giving compile time errors.

#set page(header: context {
  let page-counter =
  let matches = query(<big-table>)
  let current = counter(page).get()
  let has-table = matches.any(m =>
    counter(page).at(m.location()) == current
  )

  if not has-table [
    _Lisa Strassner's Thesis_
    #h(1fr)
    National Academy of Sciences
  ]
}))

#lorem(100)
#pagebreak()

#table(
  columns: 2 * (1fr,),
  [A], [B],
  [C], [D],
) <big-table>

Errors from typst compile foo.typ:

u@x1 ~/D/t/foo> typst compile foo.typ 
error: expected expression
  ┌─ foo.typ:2:20
  │
2 │   let page-counter =
  │                     ^

error: expected semicolon or line break
   ┌─ foo.typ:14:2
   │
14 │ }))
   │   ^

u@x1 ~/D/t/foo [1]> typst compile foo.typ
error: expected semicolon or line break
   ┌─ foo.typ:13:2
   │
13 │ }))
   │   ^

Patch:

 #set page(header: context {
-  let page-counter =
   let matches = query(<big-table>)
   let current = counter(page).get()
   let has-table = matches.any(m =>
     counter(page).at(m.location()) == current
   )
 
   if not has-table [
     _Lisa Strassner's Thesis_
     #h(1fr)
     National Academy of Sciences
   ]
- }))
+ })
 
 #lorem(100)
 #pagebreak()
 
 #table(
   columns: 2 * (1fr,),
   [A], [B],
   [C], [D],
 ) <big-table>

Reproduction URL

No response

Browsers

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions