2
votes

I work on Vim with the solarized colorscheme. In my .tex files, the syntax highlighting is different from $...$ to \[...\](or align environment).

The inline maths are in yellow, while the display-maths are in red. As you can see here

The mathzone seems recognized because i'm using a math context with Ultisnips that works.

Is this difference normal, and if it is, is there a way to highlight the both in the same way ? I precise that i'm using Vimtex.

1
I am not sure since I never really used it much but I guess it is because when you do $$ you are opening and closing the inline maths and leaving outside maths sentence. - Alessandro Candeloro
@samcarter_is_at_topanswers.xyz you're welcome, thanks for you intervention, you're totally right ! That said, any idea ? - Nnomuas

1 Answers

2
votes

That's a colorscheme inconsistency. Solarized defines highlight only for texMathZoneX but it does nothing with texMath or texMathZoneY. Hence the result. You can use other colorscheme or do some workaround. E.g.

augroup FixColors | au!
    autocmd ColorScheme solarized
        \ if &bg ==# 'dark' |
            \ hi texMath ctermfg=3 ctermbg=8 guifg=#b58900 guibg=#002b36 |
        \ else |
            \ hi texMath ctermfg=3 ctermbg=15 guifg=#b58900 guibg=#fdf6e3 |
        \ endif |
        \ hi! link texMathZoneX texMath
augroup end