Skip to content

Incorrect syntax highlighting of comments in pgf coordinate plot #3159

@noahvanhaute

Description

@noahvanhaute

Description

When placing a comment inside a \addplot coordinates{}, it is highlighted as if it was the actual content of the command and not a comment.

Steps to reproduce

Simply open the minimal file with nvim -u ~/nvim-minimal/init.lua minimal.tex and the comment inside the \addplot coordinates{} should be highlighted incorrectly.

init.lua

vim.opt.runtimepath:prepend(vim.fn.expand("~/nvim-minimal"))

vim.opt.rtp:prepend(vim.fn.stdpath("data") .. "/lazy/lazy.nvim")
require("lazy").setup({
	"lervag/vimtex",
	lazy = false,
})

minimal.tex

\documentclass{minimal}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
	% a comment with correct highlighting
	\begin{axis}
		\addplot coordinates{
				% a comment with incorrect highlighting
				(0,0)
				(1,1)
			};
	\end{axis}
\end{tikzpicture}
\end{document}

Expected behavior

The comment inside \addplot coordinates{} is highlighted like a comment.

Actual behavior

The comment inside \addplot coordinates{} is highlighted like the actual contents of that command.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Linux 5.15.167.4-microsoft-standard-WSL2
  LaTeX version: pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025/TeX Live for SUSE Linux)
  Vim version: NVIM v0.11.1
  Has clientserver: true
  Servername: /run/user/1000//nvim.2031.0
  $PATH:
    - /bin
    - /home/nvh/.local/bin
    - /home/nvh/bin
    - /mnt/c/Program Files/Mozilla Firefox
    - /mnt/c/Users/noahv/scoop/apps/win32yank/current
    - /sbin
    - /usr/bin
    - /usr/games
    - /usr/lib/wsl/lib
    - /usr/local/bin
    - /usr/local/games
    - /usr/local/sbin
    - /usr/sbin

VimTeX project: minimal
  base: minimal.tex
  root: /mnt/c/Users/noahv/documents/LaTeX/minimal
  tex: /mnt/c/Users/noahv/documents/LaTeX/minimal/minimal.tex
  main parser: current file verified
  document class: minimal
  packages: epstopdf-base graphics graphicx keyval pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfplots pgfrcs pgfsys tikz trig xcolor
  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions