Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting inside an non-top-aligned block is broken with typst latest compiler #7

Open
maugier opened this issue Sep 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@maugier
Copy link

maugier commented Sep 25, 2024

Hello,

This example (where pinit-highlight-equation-from is taken from the reference website) used to work fine with typst v0.11.1:

#import "@preview/pinit:0.2.0": *
#import "@preview/touying:0.5.2": themes


#show: themes.university.university-theme

#let pinit-highlight-equation-from(height: 2em, pos: bottom, fill: rgb(0, 180, 255), highlight-pins, point-pin, body) = {
  pinit-highlight(..highlight-pins, dy: -1em, fill: rgb(..fill.components().slice(0, -1), 40))
  pinit-point-from(
    fill: fill, pin-dx: 0em, pin-dy: if pos == bottom { 0.8em } else { -0.6em }, body-dx: 0pt, body-dy: if pos == bottom { -1.7em } else { -1.6em }, offset-dx: 0em, offset-dy: if pos == bottom { 0.8em + height } else { -0.6em - height },
    point-pin,
    rect(
      inset: 0.5em,
      stroke: (bottom: 0.12em + fill),
      {
        set text(fill: fill)
        body
      }
    )
  )
}

== CVSS

#align(horizon, block[
Exemple: #pin(1)CVSS:3.1#pin(2)/#pin(3)AC:H#pin(4)/#pin(5)AV:N#pin(6)x
])

#pinit-highlight-equation-from((1,2), (1,2), pos: bottom, height: 5em, fill: red, [Version])
#pinit-highlight-equation-from((3,4), (3,4), pos: top, height: 5em, fill: yellow, [Complexité: Haute])
#pinit-highlight-equation-from((5,6), (5,6), pos: bottom, height: 4em, fill: blue, [Vecteur: Network])

typst-good

Starting from this specific commit, typst renders it like this:

typst/typst@a52987a

typst-bad

It also throws several errors in cetz regarding multiple deprecated usages of measure() with style arguments

The code works correctly when it is align(top) instead of align(horizon).

Thanks for the great work !

@OrangeX4 OrangeX4 added the bug Something isn't working label Sep 25, 2024
@OrangeX4
Copy link
Owner

You could try to add a #box() after the #pinit-xxx function call, like #pinit-xxx()#box().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants