0xpapercut / obsidian-wypst

High quality rendering of Typst in Obsidian, powered by wypst.
MIT License
22 stars 2 forks source link

Attach does not work as expected #6

Open eniraa opened 4 months ago

eniraa commented 4 months ago

When rendering the example from Typst documentation, Wypst seems to treat t as tr and b as br. Moreover, nothing else is rendered.

Typst:

attach(
  Pi, t: alpha, b: beta,
  tl: 1, tr: 2+3, bl: 4+5, br: 6,
)

LaTeX:

\underset{\beta}{\overset{\alpha}{\prescript{1}{4+5}{\Pi}^{2+3}_{6}}}

Outputs:

screenshot_20240228T120643-0500 png@2x
0xpapercut commented 4 months ago

Hello! As of now, wypst only support b and t. I plan to expand on this on the near future; for now the idea was to implement a minimal working setup for Attach that works in most simple cases.

0xpapercut commented 4 months ago

By the way, this on my top list of TODO things, so maybe this week or the next I'll have it fixed.

eniraa commented 4 months ago

Sounds good. Good luck on your exams, by the way!

eniraa commented 4 months ago

In case you needed it, this command seems to function in the same way as Typst's attach function.

\newcommand{\attach}[7]{
    \prescript{#4}{#5}{\vphantom{#1}}
    \overset{#2}{\underset{#3}{#1}}
    \vphantom{#1}^{#6}_{#7}
}
0xpapercut commented 4 months ago

It seems prescript doesn't work in KaTeX; it's probably not possible to fix this without some arcane syntax.

eniraa commented 4 months ago

You can do something like this

\newcommand{\attach}[7]{
    \vphantom{#1}^{#4}_{#5}\underset{#3}{\overset{#2}{#1}}\vphantom{#1}^{#6}_{#7}
}