Thiago4532 / mdmath.nvim

A Neovim plugin for inline LaTeX equation previews in Markdown.
MIT License
69 stars 0 forks source link

Rendered images too small #1

Closed shin01221 closed 1 week ago

shin01221 commented 2 weeks ago

first i would like to thank you for this useful plugin second i have a scaling issue the rendered image look very tiny and i can't find a way to increase the size of it 241031_19h59m02s_screenshot

Thiago4532 commented 2 weeks ago

Currently, the image is the same size as the number of cells that are rendered. The workaround now is splitting the equation in multiple lines like this:

$$
x^2 + y^2
$$

I am currently working on a better way to solve this, creating virtual lines below the equation to allow the image to be bigger, probably the next update this won't be a problem anymore :)

shin01221 commented 1 week ago

thanks for the help and looking forward to the next update

dubrayn commented 1 week ago

Very nice plugin ! Basing the preview size on the number of cells is not convenient when working with inline LaTeX. For example, code like

This is some inline math: $S_N \equiv \frac{\pi^2}{6} \sum_{k=1}^{N} \frac{1}{k^2}$.

This a some math in a block:

$$
S_N
\equiv
\frac{\pi^2}{6}
\sum_{k=1}^{N} \frac{1}{k^2}\label{plop}
$$

will be rendered as

capture

The preview image should not use the width of the concealed block of markdown text. Sorry, I do not know your plugin enough to propose a PR.

Thiago4532 commented 1 week ago

Don't worry :), in the current state it's really hard to understand what my plugin is doing haha, just opening issues is enough to help!

About this, what's your suggestion? For latex that is not inline I can see some solutions, but what would you do for inline latex? In your example, how would you want the inline math to be displayed? Concealing the equation to reduce the line width? (just like concealing a Markdown URL)

Also as an alternative, I'll implement a out-of-line render of equations (showing the equation a line above for example), since it's really easy to implement, I want everything to be customizable and be able to adapt to every use case, so if you have another suggestion I'd be glad to hear it

dubrayn commented 1 week ago

For the inline LaTeX preview, concealing like for the markdown URLs should be fine. Concerning the out-of-line render of equations, I prefer the concealing alternative, so if this option is still available, everyone will be fine I guess. I like the fact that the width of the preview is defined by the number of lines of the markdown block, however empty lines (or even containing only spaces) can not be used to adjust this number of lines for the moment (it seems to break the block, maybe treesitter is at fault here).

Thiago4532 commented 1 week ago

This should be working now! Can you please provide a feedback if it's working for you? The option is dynamic and you can scale it using dynamic_scale.

It only works for non-inline images though, I'm going to open a new issue since solving this for inline equations is a completely different feature.

shin01221 commented 1 week ago

it's working very well now thanks.