Skip to content

Syntax highlighting broken when nested group appear in second argument of \hyperref[]{…} #3103

@user202729

Description

@user202729

Description

As in the title. See the parts highlighted in red.

Image

Seems like the problem is the argument is determined to be ended at the first }.

Not sure how easily fixable this is because in principle arbitrary text can appear in the second argument. But it seems to work well with \href. (I have conceal enabled which hides the \href when the cursor is away from the line.)

Image

Steps to reproduce

Type the following in a document

%! TEX program = pdflatex
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
\section{test section}
\label{stuff}

\hyperref[stuff]{hello $5^{23}$ world}
hello $5^2$ world

\end{document}

and observe the red characters in syntax highlighting. \lx may be needed after saving the file to load hyperref package syntax highlighting.

Expected behavior

No error happened.

Actual behavior

No response

Do you use a latexmkrc file?

Yes

VimtexInfo

Using latest master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions