Leedehai/typst-physics

Wrong upright style and spacing for vecrow() and Greek letters

CarrotDLaw opened this issue · 3 comments

When the first element in vecrow() is a Greek letter, there are unexpected spacing and upright style issues, like the first three lines in the following. The last three lines are how the output is supposed to be.

I found a temporary solution that is to use italic(alpha) instead of just alpha in the first element, though.

$
& vecrow(alpha, beta) \
& vecrow(alpha, italic(beta)) \
& vecrow(alpha, b) \
& vecrow(a, beta) \
& vecrow(italic(alpha), beta) \
& (alpha, beta) \
$
image

Some investigation:

#let vecrow(..content) = $lr(( #content.pos().join(",") ))$

test

#grid(columns: (1fr, 1fr), [
  ```typst $lr((alpha, beta/gamma))$```

  $lr((alpha, beta/gamma))$

  #repr($lr((alpha, beta/gamma))$)
], [
  ```typst $vecrow(alpha, beta/gamma)$```

  $vecrow(alpha, beta/gamma)$

  #repr($vecrow(alpha, beta/gamma)$)
])

Possible fix

  • Change "," to [,]

    #let vecrow(..content) = $lr(( #content.pos().join([,]) ))$

  • Directly use math.lr

    #let vecrow(..content) = math.lr([(] + content.pos().join([,]) + [)])

    It imitates $lr(…)$ better, but longer…

Wow, thanks! Let me see..

@YDX-2147483647 It works 👍 I committed 8df2cc4 and added you as the author.