Leedehai / typst-physics

physica: vectors, fields, differentials, derivatives, Dirac brakets, tensors, and more. See examples in the manual PDF.
https://github.com/Leedehai/typst-physics
MIT License
343 stars 11 forks source link

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

Closed CarrotDLaw closed 10 months ago

CarrotDLaw commented 10 months ago

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
YDX-2147483647 commented 10 months ago

Some investigation:

https://github.com/Leedehai/typst-physics/blob/94c89824cbb69d1513e49ea7ea3d0bd90f7016fd/physica.typ#L152

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

Leedehai commented 10 months ago

Wow, thanks! Let me see..

Leedehai commented 10 months ago

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