How to add spacing after an horizontal line in the footer?

Hi, I’m having trouble figuring out what I’m doing wrong—perhaps it’s something simple. I’m trying to create a footer that includes:

  • A horizontal line at the top
  • Left-aligned text
  • Right-aligned page numbering
  • Some vertical space between the horizontal line and the text below it

The issue is that when I try to add spacing after the horizontal line, it throws off the left and right alignment of the footer content. I’ve tried adding the space before defining the columns, and I’ve also tried inserting it within the grid rows, but I haven’t been able to get it to work as intended.

Any guidance would be appreciated.

footer: context [
  #grid(
    // Line above footer
    grid.hline(stroke: 1pt + rgb("#C3A463")),
    columns: (1fr, 1fr),
    align: (left, right),
    //[#v(6pt),#v(6pt)],
    // Two separate cells: left and right
    [ Lehigh County, Office of the Controller ],  // left cell
    [ #counter(page).display("1/1", both: true) ], // right cell
  
  )

Is there a reason why you need/want to use a grid? If not, it would be much simpler to use a regular horizontal line, and then a horizontal spacing h(1fr) to make the text left-aligned and the page counter right-aligned.

#set page(footer: context {
  line(length: 100%)
  "Lehigh County, Office of the Controller"
  h(1fr)
  counter(page).display("1/1", both: true)
})

This will automatically give you some vertical spacing between the line and the text below it. You could further adjust this by including a (negative) v() after the line.

And two general things:

  • Please use the Questions category for posts that are clearly questions. And the title should be something you would ask a friend, e.g. “How do I change the layout of text and page numbering in the footer?”
  • If you include (Typst) code in your post, please wrap it in ```typ ... ``` to get syntax highlighting. This makes it much easier to read your code.

For the official “how-to” on posting questions, please see the post below.

2 Likes

Thank you. That worked. I am still learning the Typst vocabulary :) This works much better than what I did. I assumed I needed to cells. Thank you also for the How to post!