Skip to content

Discussion/Suggestion: any way to "tweak" this kind of highlight? #3077

@Rmano

Description

@Rmano

This is really not an issue, but I think there is no "Discussion" for vimtex...

Consider the snippet, in the preamble:

\documentclass{article}
\newcommand{\shunt}{\mathop{/\!/}}
\NewDocumentCommand{\varappend}{m o m}{%
        \IfNoValueTF{#2}{#1_{\textup{#3}}}{#1_{#2_{\scriptstyle\textup{#3}}}}%
    }
\NewDocumentCommand{\varmin}{m o}{\varappend{#1}[#2]{mín}}
\NewDocumentCommand{\varmax}{m o}{\varappend{#1}[#2]{máx}}
\begin{document}
what $\varappend{V}[CE]{rms}$ 
\end{document}

Which is highlighted like this: (I have catppuccin-latte colorscheme, with a special hl on error):

Image

I understand that the _ underscores are marked as an error because nobody knows that the macro is supposed to be used in math mode. Yes, I can wrap it in \ensuremath{}, but suppose I prefer not to do that... is there any option to avoid that? Some kind of magic comment?

(The spellchecker errors in argument are another nuisance, but not related to vimtex, although I'd be grateful for suggestions...)

System info:
  OS: Manjaro Linux
  Vim version: NVIM v0.10.2
  Has clientserver: true
  Servername: /home/romano/.cache/nvim/server-desktop_1.pipe

VimTeX project: lulla
  base: lulla.tex
  root: /home/romano/tmp
  tex: /home/romano/tmp/lulla.tex
  main parser: current file verified
  document class: article
  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
    job: 
      jobid: 16
      output: /tmp/nvim.romano/oV9cia/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode  -pdf -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'lulla.tex'
      pid: 11340
  viewer: General
    job: 
      pid: -
      cmd: okular '/home/romano/tmp/lulla.pdf'
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions