Closed Ma94xx closed 1 year ago
Inline math (
$1+1=2$
) is not detected as environment, hence no commands likets$
orci$
are working.
It works for me in. You seem to indicate that you are testing this with some minimal setup, but I believe you are not doing that properly.
Steps to reproduce
nvim -u minimal.vim minimal.tex
Two immediate things:
minimal.vim
and minimal.tex
? The point with "steps to reproduce" is that, if this is really a bug, then I should be able to reproduce it. But I can't reproduce without knowing the contents of the files!nvim --clean -u minimal.vim minimal.tex
. The --clean
option is important to avoid that your regular configuration is also loaded.The standard minimal.vim
that I use to suggest looks like this:
set nocompatible
" YOU NEED TO CHANGE THE FOLLOWING LINES!
" Use the path to VimTeX on YOUR system
set runtimepath^=~/.local/plugged/vimtex
set runtimepath+=~/.local/plugged/vimtex/after
filetype plugin indent on
syntax enable
" VimTeX options go here, e.g.
let g:vimtex_view_method = 'zathura'
The standard minimal LaTeX file is:
\documentclass{minimal}
\begin{document}
Hello World!
\end{document}
Well, so I messed things up. I'm sorry. The content of the minimal.tex is the following:
\documentclass{minimal}
\begin{document}
Hello $World!$
\end{document}
And the content of my minimal.vim
set nocompatible
" YOU NEED TO CHANGE THE FOLLOWING LINES!
" Use the path to VimTeX on YOUR system
set runtimepath^=~/.local/share/nvim/site/pack/packer/start/vimtex
set runtimepath+=~/.local/plugged/VimTeX
filetype plugin indent on
syntax enable
" VimTeX options go here, e.g.
let g:vimtex_view_method = 'zathura'
In the minimal version it works (I guess the --clean flag did it). So I guess its not a vimtex bug. Sorry for opening an issue. Any idea what could cause this? Or any known conflicting plug ins?
And the content of my minimal.vim …
Thanks; notice, you either copied the wrong file, or you made a minor mistake (that I don't think is relevant for this particular case):
set runtimepath^=~/.local/share/nvim/site/pack/packer/start/vimtex
" this is correct:
set runtimepath+=~/.local/share/nvim/site/pack/packer/start/vimtex/after
In the minimal version it works (I guess the --clean flag did it). So I guess its not a vimtex bug. Sorry for opening an issue.
No need to apologize!
Any idea what could cause this? Or any known conflicting plug ins?
Yes, or, I do have ideas for how to figure it out. My main hypothesis is that you are using Treesitter for highlighting. This will disable VimTeXs syntax highlighting, which ts$
and ci$
and similar depend on. See :help vimtex-faq-treesitter
. You can easily check by doing :Inspect
when your cursor is within inline math, for instance. To disable Treesitter highlighting for LaTeX, you can change your treesitter config like this:
require("nvim-treesitter.configs").setup {
-- … whatever config your are using
highlight = {
enable = true,
disable = { "latex" },
},
}
If that is not the cause, then, after opening a .tex
file: What is the ouput of :map ts
and :map ci
?
Thank you so much! That actually worked! Never thought of treesitter being an issue for vimtex. Just because I didn't mention so far: vimtex is awsome! thanks for sharing!
Glad to hear it works now; and thanks for the kind words! :)
I am experiencing the same issue in vim.
My minimum file:
\documentclass{minimal}
\begin{document}
Hello $World!$
\begin{displaymath}
2+2
\end{displaymath}
\end{document}
My VimtexInfo:
System info:
OS: Fedora release 38 (Thirty Eight)
Vim version: VIM 9.1 (1-158)
Has clientserver: false
VimTeX project: foo
base: foo.tex
root: /home/sergio
tex: /home/sergio/foo.tex
main parser: fallback current file
document class:
compiler: latexmk
engine: -pdf
options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
callback: 1
continuous: 1
executable: latexmk
viewer: General
qf method: LaTeX logfile
:map ts
show the line n ts$ @<Plug>(vimtex-env-toggle-math)
, :map ci
shows nothing.
As far as I know, I disabled all packages (except for vimtex) and .vimrc consists solely of
syntax on
filetype plugin on
filetype indent on
Any hints for troubleshooting?
How did you install VimTeX?
The best approach is really to open a new issue and describe by use of the issue template. Your issue is most likely not the same as the original issue in this thread.
Thanks, I hope this is OK! https://github.com/lervag/vimtex/issues/2915
Inline math (
$1+1=2$
) is not detected as environment, hence no commands likets$
orci$
are working. If I try to toggle from displaymath, it works as expected.Steps to reproduce
nvim -u minimal.vim minimal.tex
$3+3=6$
ts$
in normalmodeExpected behavior
I expect
$3+3=6$
to change to\begin{displaymath}3+3=6\end{displaymath}
Actual behavior
The cursor jumps to the next
$
sign or does nothing, but no other changes are madeDo you use a latexmkrc file?
No
VimtexInfo
Edit: After updating nvim, I get this error message when trying to toggle displaymath with
ts$