Subject: Fontification of single brace in an optional argument

From: Arash Esbati <[email-masked]>
Date: Thu, 01 Sep 2022 11:31:25 +0200

Hi all,

please consider this artificial but valid LaTeX code:

--8<---------------cut here---------------start------------->8---
\documentclass{article}

\usepackage{siunitx}

\begin{document}

\numlist[list-separator={[ }]{0.1;0.2;0.3}

Some text here

\numlist[list-separator={] }]{0.1;0.2;0.3}

\numlist[list-separator={; }]{0.1;0.2;0.3}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---

which looks like this with emacs -Q and vanilla AUCTeX:

Note how the first {[ } extends the fontification until the next {] }.
I think the issue is in the function `font-latex-find-matching-close',
but I don't have an idea how to fix this.  Any takers?

Best, Arash