Skip to content

\lceil and \rceil classified into hl_group texMathSymbol instead of texMathDelim #3134

@jammychiou1

Description

@jammychiou1

Description

I have noticed a strange syntax highlighting for the delimiter pair \lceil and \rceil, compared to the other delimiter pairs like \lfloor and \rfloor, \lvert and \rvert, etc.

Somewhat strangely, the pair \left\lceil and \right\rceil is highlighted correctly.

Image

The :Inspect command from Neovim confirms that \lceil and \rceil are being classified into hl_group texMathSymbol, instead of texMathDelim like \lfloor and \rfloor are.

After a quick glance, I suspect that the issue has to do with 'lceil' and 'rceil' being included in s:cmd_symbols from autoload/vimtex/syntax/core.vim.

\ ['lceil', ''],

\ ['rceil', ''],

Steps to reproduce

  1. nvim -u minimal.lua minimal.tex

minimal.lua:

-- modified from "Single File Setup" at https://lazy.folke.io/installation

-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Setup lazy.nvim
require("lazy").setup({
  spec = {
    -- add your plugins here
    'lervag/vimtex',
  },
})

minimal.tex:

\documentclass{minimal}

\usepackage{amsmath}

\begin{document}

$\lfloor x \rfloor$
$\lvert x \rvert$
$\lceil x \rceil$

$\left\lfloor x \right\rfloor$
$\left\lvert x \right\rvert$
$\left\lceil x \right\rceil$

$1 \geq 0$

\end{document}

Expected behavior

I expect \lceil and \rceil to be classified into hl_group texMathSymbol, and highlighted in the same way as \lfloor and \rfloor are.

Actual behavior

I observe that \lceil and \rceil were classified into the unexpected hl_group texMathSymbol, thus highlighted in the same way as \geq, for example.

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Linux 6.13.8-200.fc41.x86_64
  Vim version: NVIM v0.10.4
  Has clientserver: true
  Servername: /tmp/nvim.root/NH3v2Z/nvim.159.0

VimTeX project: minimal
  base: minimal.tex
  root: /root
  tex: /root/minimal.tex
  main parser: current file verified
  document class: minimal
  packages: amsmath
  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