I am trying to set up a template using the Chic-hdr package, so that the document title from a #set document(title:[]) will be entered in the centre field of the header with the page number on the right. I have the following code:
#let title = [Document title]
#set page(
paper: "a6",
header: context {
// set text(8pt)
let n = counter(page).display()
align(center)[#title];
align(right)[#n]
},
)
#set par(justify: true)
#range(5).map(_ => lorem(50)).intersperse(parbreak()).join()
but, while it places “Document title” in the centre, it is raised above the expected position on the page, as if on a separate line from the page number.
The problem with the documentation is that the examples bear little relation to what someone like me needs and just make it more complex. context is very much a case in point; your solution is simple, but there is no way I would have arrived at it having spent a long time going over the docs again and again, and trying to understand apparently relevant code from posts in this forum.
Mark
P.S. I have enclosed the code in backticks , but it’s not applying the colour coding and I don’t know why!