bug: LaTeX rendering fails when = is on its own line in math block
Did you check docs and existing issues?
- [x] I have read all the snacks.nvim docs
- [x] I have updated the plugin to the latest version before submitting this issue
- [x] I have searched the existing issues of snacks.nvim
- [x] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM v0.11.4 Build type: RelWithDebInfo LuaJIT 2.1.1761727121 Run "nvim -V1 -v" for more info
Operating system/version
Archlinux
Describe the bug
When a LaTeX math block contains = on a standalone line, the image fails to render. Moving = to the same line as other content fixes the issue.
Steps To Reproduce
Not working:
$$
\begin{bmatrix}
1 \\ 2
\end{bmatrix}
=
\frac{1}{2}
\begin{bmatrix}
2 \\ 4
\end{bmatrix}
$$
Working:
$$
\begin{bmatrix}
1 \\ 2
\end{bmatrix} =
\frac{1}{2}
\begin{bmatrix}
2 \\ 4
\end{bmatrix}
$$
Expected Behavior
= on a standalone line,
Repro
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{ "folke/snacks.nvim", opts = {} },
-- add any other plugins here
},
})
I don't do latex, so feel free to create a PR
Likely related to how treesitter extracts the math content from the $$ block. When the = is on its own line, it may be creating a parsing boundary that causes the displayed equation node to be split or captured incorrectly.
A possible workaround would be to add a preprocessing step that normalizes standalone operators on their own lines. Not sure
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.