Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect syntax highlighting for \nameref #2208

Closed
zoomiti opened this issue Oct 15, 2021 · 2 comments
Closed

Incorrect syntax highlighting for \nameref #2208

zoomiti opened this issue Oct 15, 2021 · 2 comments
Labels

Comments

@zoomiti
Copy link

zoomiti commented Oct 15, 2021

Description

When using \nameref{something} something is not syntax highlighted white, and spell is still turned on for something.

Steps to reproduce

  1. nvim -u minimal.vim minimal.tex
\documentclass{article}
\usepackage{hyperref}

\begin{document}

\section{Test}
\label{osc}
\autoref{osc}
\nameref{osc}
\ref{osc}
\eqref{osc}

\end{document}

Expected behavior

I expect all the \ref to syntax highlight their contents white and turn spell off within them.

Actual behavior

All but \nameref is correctly syntax highlighted.

image

Do you use a latexmkrc file?

No

VimtexInfo

System info
  OS: Linux 5.10.16.3-microsoft-standard-WSL2
  Vim version: NVIM v0.5.1
  Has clientserver: true
  Servername: /tmp/nvim51nQtp/0

VimTeX project: test
  base: test.tex
  root: /mnt/c/Users/sotol/OneDrive/Documents/School/2021 Fall/Circuits/Lab5
  tex: /mnt/c/Users/sotol/OneDrive/Documents/School/2021 Fall/Circuits/Lab5/test.tex
  main parser: current file verified
  document class: article
  packages: atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook bigintcalc bitset etexcmds gettitlestring hycolor hyperref iftex infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro ltxcmds nameref pdfescape pdftexcmds refcount rerunfilecheck uniquecounter url
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  qf method: LaTeX logfile
@zoomiti zoomiti added the bug label Oct 15, 2021
@clason
Copy link
Contributor

clason commented Oct 17, 2021

hyperref loads the nameref package at \begin{document}; not sure whether it makes sense to add a package syntax for it, or just add \\nameref after

syntax match texCmdHyperref '\\autoref\>' nextgroup=texRefOpt,texRefArg

(I assume the vast majority of users load hyperref, and very few just load nameref directly?)

@lervag
Copy link
Owner

lervag commented Oct 17, 2021

Good question, @clason. I believe the most correct thing would be to add a package for nameref and load it from hyperref. I don't think doing it this way will have any negative impacts, so I'll just do that.

@lervag lervag closed this as completed Oct 17, 2021
lervag added a commit that referenced this issue Oct 17, 2021
lervag added a commit that referenced this issue Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants