0

I have read through a lot of the posts on spell checking LaTeX syntax - here, here, and here.

I am sure the problem is my lack of regex understanding, but I am having trouble configuring it so that LaTeX commands that take multiple arguments (and optional arguments) are ignored. For instance, the \Cites command can have any number of optional/argument pairs. I would like to ignore all of them. So whether it is \Cites[10]{AuthorYear1}[20]{AuthorYear2} or \Cites[10]{AuthorYear1}[20]{AuthorYear2}[30]{AuthorYear3} or even \Cites[10]{AuthorYear1}{AuthorYear2}[30]{AuthorYear3} or any combination, the BibTeX keys are ignored from the spell checker.

This is something that can be done in aspell quite easily in ~/.aspell.conf with something like add-tex-command Cites opopopopopopopopopopopopopopop. (Of course this assumes there is always an optional argument, which for me is true 99.99% of the time. If not, I can add a tex command where the non-optional argument is first, and then always cite keys without an optional argument first.)

I am not using vim-tex. I eventually want to try it out, but I am close to finishing my dissertation and don't really want to change my setup at this point. So if there is a solution for how to do something like:

syntax match texStatement '\\Cite' nextgroup=texMyCommandMult
syntax region texMyCommandMult matchgroup=Delimiter start='\[' end='}' contained contains=@NoSpell

in my ~/.vim/after/syntax/tex.vim that would be very helpful.

3
  • This stuff has this strange combination of being simple and complex. I have support for this in VimTeX, see here: github.com/lervag/vimtex/blob/… I understand that you don't want to use it now. But one possibility could be to disable all features except the syntax. I.e., if you install the plugin, then do let g:vimtex_..._enabled = 0 on all the various enable options except syntax. I believe it should "just work". Commented Oct 14, 2021 at 6:57
  • @KarlYngveLervåg thanks! I definitely want to try out vimtex, so maybe I just need to bite the bullet and spend some time switching over. I am using vim-latex (solely because I have been using it for 10 years) and have a lot of "muscle memory", haha.
    – Paul
    Commented Oct 15, 2021 at 15:08
  • 1
    I believe you will find VimTeX to be a nice upgrade from vim-latex. Feel free to open issues on the github repo if you have any problems, or contact me on the gitter/element chat if you need advice. Commented Oct 17, 2021 at 9:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.