How to add line to the right of a section heading

Hello,

I have my resume with section headers like so:

Current state

And I’m trying to write some text to the right of it, like so (this isn’t from Typst, only for visualization purposes):

Desired state

Here is how my header is defined:

// Small caps for section titles
  show heading.where(level: 2): it => [
    #pad(top: 0pt, bottom: -10pt, [#smallcaps(it.body)])
    #line(length: 100%, stroke: 1pt)
  ]

And the header itself is written as:

== Projects

How would I go about doing this? Any solution will be greatly appreciated. Happy to provide more code from my file as well.

Here’s one way to do it - while having to turn off or negate settings is not so robust, I think it’s for the better, because placing the text inside the heading’s title is the quickest way to get it positioned correctly.

#set text(size: 10pt)
#show heading.where(level: 2): it => [
    #pad(top: 0pt, bottom: -10pt, [#smallcaps(it.body)])
    #line(length: 100%, stroke: 1pt)
  ]

#let centertext(txt) = {
  // 'turn off' smallcaps, turn off bold
  set text(features: (smcp: 0), weight: "regular")
  show: emph
  h(1fr)
  txt
  h(1fr)
}

== Projects #centertext[View source code and documentation on GitHub]

screenshot

1 Like

Amazing, thanks so much! Exactly what I was looking for.