How to put current Heading Level 1 and Numbering on top of header line?

Hey!

I am creating my first thesis and my word template requires a specific header with a horizontal line and above the current heading level 1 and the page numbering as shown in my screenshot.
I only managed to put the line there, whenever I try to align the numbering on top it disappears…

Could you share the code snippet you are using that fails?

#set page(
  margin:(top:30mm,bottom:30mm,left:30mm,right:25mm), 
 // header: (line(length:100%)),
   header: context {
    align(left, (hydra(1)) + h(1fr) + "Hallo")
    line(length: 100%)
  },
 )

#align(top, numbering("I"))

The Hello appears where the number should appear, the top aligned numbering doesnt appear at all

1 Like

Thanks. Additional to that, if you could please edit your post and enclose your code with three backticks before and after, we will be able to read it better. Thanks. :pray:

``` 
code 
``` 
1 Like

What you are trying is not meant to be working.

Try:

#import "@preview/hydra:0.6.2": hydra
#set page(
  margin: (top: 30mm, bottom: 30mm, left: 30mm, right: 25mm),
  // header: (line(length:100%)),
  header: context {
    align(left, (hydra(1)) + h(1fr) + counter(page).display())
    line(length: 100%)
  },
)

//#align(top, numbering("I")) // This will not show anything

= First
== Sub

#lorem(1000)

Have you read through the manual for Hydra?

Thank you, this is a major improvement. Though, now it displays the last Heading from the site before. Say, on the Table of Contents page, there is still “Abstract” from a page before in the header. Is this solvable through the package?

Edit: Found the solution. Its doable through the (use-last: bool) function of hydra. set it true with

#let hydra = hydra.with(use-last: true)

and it will show the last heading on the page as the header, not the one active before

1 Like

Are you using a template or creating your own? Many templates already provide the proper integration with Hydra. It would help to know with which one you are working if it is public.

I am asking because you are most likely going to encounter a problem with displaying the page number if you switch from roman to arabic numbering.