Why did alignment of my outline entries break in Typst 0.13.0?

Hi, I’m facing an issue that I can’t solve myself.
In my templates, small part outlines was styled as follow:

set text(size: textSize, fill: textColor, weight: textWeight)
box(width: 1.1cm, inset: (y: insetSize), align(left, number))
h(0.1cm)
box(inset: (y: insetSize), width: 100% - 1.2cm, )[
  #link(location, title)
  #box(width: 1fr, repeat(text(weight: "regular")[. #h(4pt)])) 
  #link(location, heading_page)
]

This code was working until Typst 0.12.0, but with Typst 0.13.0 I’m facing an unwanted align when the text is too long to fit in one line.

image

This was the same result with Typst 0.12.0

This is the minimum reproducible example.

https://typst.app/project/rji1x14t2hEFf5ZS7ZwhFp

Do you have any idea? Thanks a lot.

Hi, could you provide a minimal reproducible example?

Hi, this is the example, thanks: Typst

You have your whole outline wrapped in an align(bottom + right, ..) block. The alignment of the outline then propagates to the outline entries, thus the individual lines of the title are also right-aligned. You can fix this by overriding the alignment inside the box containing the title, similar to how you did it for the number:

#let my-outline-row(..) = {
  set text(size: textSize, fill: textColor, weight: textWeight)
  box(width: 1.1cm, inset: (y: insetSize), align(left, number))
  h(0.1cm)
  box(inset: (y: insetSize), width: 100% - 1.2cm, )[
    #set align(left) // <-- Add this line
    #link(location, title)
    #box(width: 1fr, repeat(text(weight: "regular")[. #h(4pt)])) 
    #link(location, heading_page)
  ]
}

Thanks a lot. I don’t understand why the behavior changed with 0.13.0. Maybe it was a bug of the previous versions…

Hey @Flavio, glad you’ve solved your problem. I’ve marked @Eric’s response as a solution. Please let us know if this was a mistake.

In addition, I’ve renamed your post so it is a question per our guidelines: How to post in the Questions category

Hope you have a great time at the forum!