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

end } on \SI commands with ^ is highlighted as texGroupError #2167

Closed
imyxh opened this issue Sep 12, 2021 · 4 comments
Closed

end } on \SI commands with ^ is highlighted as texGroupError #2167

imyxh opened this issue Sep 12, 2021 · 4 comments
Labels

Comments

@imyxh
Copy link

imyxh commented Sep 12, 2021

Description

First of all, thank you for this wonderful package! I just have a small cosmetic bug to file—the closing bracket on \SI commands, when the command has a ^ in it, is highlighted as texGroupError despite being valid syntax.

Steps to reproduce

Minimal vimrc:

call plug#begin('~/.local/share/nvim/plugged')
Plug 'lervag/vimtex'
" interestingly enough, the above line does make a difference!
call plug#end()

The following .tex file shows the behavior for me:

\documentclass{article}

\usepackage[fleqn]{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{gather*}
	c = \SI{299792458}{m.s^{-1}}
\end{gather*}

\end{document}

Expected behavior

No response

Actual behavior

See below; the last } on line 9 is highlighted despite being perfectly valid syntax.
image

One weird thing is that if I remove the Plug 'lervag/vimtex' from my vimrc, the highlighting error shifts to the ^, which is now highlighted with texOnlyMath:
image

Do you use a latexmkrc file?

No

VimtexInfo

System info
  OS: Arch Linux
  Vim version: NVIM v0.5.0
  Has clientserver: true
  Servername: /tmp/nvimg3cv04/0

VimTeX project: test
  base: test.tex
  root: /home/imyxh/git/wesleyan-courses/ASTR155/hw1
  tex: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.tex
  out: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.pdf
  log: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.log
  aux: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.aux
  fls: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.fls
  main parser: current file verified
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
    job: 5
    pid: 3960288
    cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$pdf_previewer = "evince"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
  viewer: General
  qf: LaTeX logfile
    root: /home/imyxh/git/wesleyan-courses/ASTR155/hw1
    addqflist: 57
    errorformat_saved: 
    fix_paths: 58
    main: /home/imyxh/git/wesleyan-courses/ASTR155/hw1/test.tex
    set_errorformat: 56
  document class: article
  packages:
    amsbsy
    amsgen
    amsmath
    amsopn
    amstext
    array
    expl3
    keyval
    l3keys2e
    siunitx
    translator
    xparse
    xparse-2020-10-01
@imyxh imyxh added the bug label Sep 12, 2021
@imyxh
Copy link
Author

imyxh commented Sep 12, 2021

In other words, when I have Plug 'lervag/vimtex' in my vimrc, then:
{ in SI unit arguments are recognized as texSIArgUnit, but } are recognized as texDelim, causing any future } to be seen as unmatched end brackets and highlighted as syntax errors.

If I do not have Plug 'lervag/vimtex' in my vimrc, then:
^ in SI unit arguments is recognized as texOnlyMath and highlighted as a syntax error.

lervag added a commit that referenced this issue Sep 12, 2021
@lervag
Copy link
Owner

lervag commented Sep 12, 2021

I think it should work now; please update and test.

@lervag lervag closed this as completed Sep 12, 2021
@imyxh
Copy link
Author

imyxh commented Sep 13, 2021

Thank you so much! It works perfectly now :)

@lervag
Copy link
Owner

lervag commented Sep 13, 2021

Happy to hear it!

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

No branches or pull requests

2 participants