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

wrongly parsed equation #52

Closed
max397574 opened this issue Nov 3, 2022 · 11 comments
Closed

wrongly parsed equation #52

max397574 opened this issue Nov 3, 2022 · 11 comments

Comments

@max397574
Copy link
Contributor

image

y_{unten}=-\sqrt{r^2-x^2}
looks like the top part of the sqrt is aligned to the left

@max397574
Copy link
Contributor Author

just had the same with a fraction

@jbyuki
Copy link
Owner

jbyuki commented Nov 3, 2022

Could you try to pull the latest and see if the issue still persists? The equation looks fine for me.
Otherwise what delimiters do you use?

@max397574
Copy link
Contributor Author

it still doesn't work
it happens with $xxx$, $$xxx$$ and \[xxx\]

jbyuki added a commit that referenced this issue Nov 3, 2022
mentionned in #52
@jbyuki
Copy link
Owner

jbyuki commented Nov 3, 2022

Could be another plugin interferring, I just ran it the test case on the Github CI and the equation is displayed correctly.

The following code should give the formula in an array:

local parser = require("nabla.latex")
local exp = parser.parse_all([[y_{unten}=-\sqrt{r^2-x^2}]])
local ascii = require("nabla.ascii")
local g = ascii.to_ascii({exp}, 1)
local drawing = vim.split(tostring(g), "\n") -- table of lines with the formula in ASCII form

If the array of lines is correct, the issue is when displaying into a popup.

@jbyuki
Copy link
Owner

jbyuki commented Nov 4, 2022

Have you got a clue on what was wrong? I cannot reproduce this so it's difficult for me to do anything.

@max397574
Copy link
Contributor Author

the output from the above code snippet is correct
but what's displayed in the window is wrong

@jbyuki
Copy link
Owner

jbyuki commented Nov 7, 2022

Something must be happening to the buffer, like a auto-formatter kicking in. nabla.nvim only takes those lines and put them in a float buffer using vim.lsp.util.open_floating_preview. I'll close this for now because I don't think it's related to nabla.nvim directly.

@jbyuki jbyuki closed this as completed Nov 7, 2022
@max397574
Copy link
Contributor Author

it seems like noice.nvim causes issues
not sure if I should open an issue here or there

@max397574
Copy link
Contributor Author

you have to pass stylize_markdown=false as an option to vim.lsp.util.open_floating_preview

@max397574
Copy link
Contributor Author

that fixes this issue and also improves highlighting I just realized xD
@jbyuki

@jbyuki
Copy link
Owner

jbyuki commented Nov 7, 2022

Thanks for the debug, I haven't installed noice so that's why I didn't see it but probably a lot have. I'll do that one change you mention.

jbyuki added a commit that referenced this issue Nov 7, 2022
plugins like noice.nvim seem to interfer. Fix by
@max397574 to add `stylize_markdown=false` fixes
everything.

Mentionned in #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants