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

math in titles #39

Closed
joleeee opened this issue Dec 3, 2023 · 7 comments
Closed

math in titles #39

joleeee opened this issue Dec 3, 2023 · 7 comments
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@joleeee
Copy link

joleeee commented Dec 3, 2023

when using typst in titles, it's not rendered as big as it should be

# Big Theta - $Theta$

Text:
image

Rendered:
image

@fenjalien
Copy link
Owner

Not sure if this really is a bug or working as intended. Math blocks have no context of where they are, so extra styling is incredibly difficult to apply. We could get more context by using a codemirror extension but I haven't found a way to completely stop Obsidian's own math blocks.

@fenjalien fenjalien added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed labels Dec 3, 2023
@joleeee
Copy link
Author

joleeee commented Dec 4, 2023

i mean the built in latex math blocks work fine in titles so i definitely think this is a bug

@Enter-tainer
Copy link

Enter-tainer commented Dec 13, 2023

Not sure if this really is a bug or working as intended. Math blocks have no context of where they are, so extra styling is incredibly difficult to apply. We could get more context by using a codemirror extension but I haven't found a way to completely stop Obsidian's own math blocks.

Hi I'm doing similar thing last week(rendering typst to svg and embed them in markdown). To solve this you need to adjust the svg: by changing the unit of its height and width to em, the svg will automatically scale itself according to the font size.

Code here: https://github.com/Myriad-Dreamin/typst.ts/blob/main/projects/rehype-typst/lib/index.js#L116

And this is how it looks like
image

@Enter-tainer
Copy link

Also I see currently the css is set to

.typst-doc {
    vertical-align: bottom;
}

There can be better control of this by querying the location of text baseline in typst and set vertical-align according to it.

@Enter-tainer
Copy link

I guess the optimize svg thing is no longer needed too because currently typst use a stable id to name glyphs so there is no collisions now.

@joleeee
Copy link
Author

joleeee commented Jan 10, 2024

I guess related is:

some vec $vec(1,2,3)$.

renders as
image

meawhile without the plugin this

some vec $\begin{pmatrix}1\\2\\3\end{pmatrix}$.

renders as
image

@fenjalien
Copy link
Owner

As of version 0.9 the output SVG's size is in em which should scale with the font size of the line it is on including headings. This does highlight another issue of the base line but that should be discussed in a new issue.

I guess related is:

some vec $vec(1,2,3)$.

...

@joleeee This is related to #17, please discuss it there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants