1

I have a tikzpicture inside a latex file. My problem is that when I open the file and jump with GG to the end of the file, the math environment inside the tikz-nodes is not highlighted (e.g. $v_0^1$). The dollar signs as well as the stuff inside it is 'white'. However, when I scroll (pressing j) from the start to the bottom, it highlights the math stuff correctly (dollar signs as well as the math content). I have no clue why this happens.

I tried to create a minimal working example, and I really need the spaced lines + singleton lines to have the bug, otherwise it works correctly. Some things which might be interesstring to know: Removing the \section-command does fix the problem. My file has 144 lines, When I press GG, the topmost line I still see is line 113. I run Arch Linux and vim version 'version 8.2.1704'. My .vimrc is

syntax enable
let g:tex_flavor = 'latex'

The file:

\documentclass[a4paper,11pt]{book}
\begin{document}
w






























\section{test}
test
test

























w



e

w

w


w
w


w

w
w
w
w




w
w

w
w

w
w

w







    \begin{figure}[t]
      
      







      \begin{tikzpicture}
        \node[ above left = 8ex and 8ex of v1] (v01) {$v_0^1$};
        \node[ below left = 8ex and 8ex of v1] (v02) {$v_0^\PVCParal$};
        \node[below left = 1ex and 2ex of v02] (labelV0) {\Large$V_0(\GK)$};
      \end{tikzpicture}
    \end{figure}
























\end{document}
4
  • 1
    Welcome to Vi and Vim! This happens with any kind of file with complex syntax (and even sometimes with simple syntax). Does :syntax sync fromstart help?
    – D. Ben Knoble
    Nov 6, 2020 at 14:16
  • Yes it does, thank you! Can you please link me to some resource on why and when this happens? I'm really interested in why this only happens for this one tikz-picture, but not for my other ones. Nov 6, 2020 at 14:26
  • 1
    I'm not 100% sure; I think it has to do with vim's syntax not "catching up," particularly with recursive syntaxes. cf. :help :syn-sync
    – D. Ben Knoble
    Nov 6, 2020 at 15:03
  • Thank you for the reference! Nov 7, 2020 at 8:39

1 Answer 1

1

While I can't suggest why this happens (cf. :help :syn-sync), a usual fix is :syntax sync fromstart, or to increase maxlines, or similar tweaks.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.