auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax classes of text in href


From: Arash Esbati
Subject: Re: Syntax classes of text in href
Date: Fri, 13 Jan 2023 11:28:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

>> How about this:

First of all, my last patch wasn't correct, please try this one if you
want to test:

--8<---------------cut here---------------start------------->8---
diff --git a/font-latex.el b/font-latex.el
index b78cf58a..0d32eab1 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1095,7 +1095,10 @@ have changed."
                   ;; Some macros take an optional argument.  This is
                   ;; the same line as above for environments.
                   "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
-                  "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)")
+                  "\\({\\)"
+                  "\\(?:[^}{]*\\(?:{[^}{]*}[^}{]*\\)*\\)"
+                  "[^\\]\\(?:\\\\\\\\\\)*"
+                  "\\(}\\)")
          (1 "|") (2 "|")))))
   (when font-latex-syntactic-keywords-extra
     (nconc font-latex-syntactic-keywords font-latex-syntactic-keywords-extra))
--8<---------------cut here---------------end--------------->8---

> Hmm. That would fail if some verbatim macro has an intentional unpaired
> "{" in its argument like \foobar{aaa"{"bbb} .
> But maybe it's a corner case that we don't have to worry about. I'm not
> sure.

This is indeed a corner case: Packages like fvextra.sty which allow
things like \Verb{content} explicitly require balanced braces;
\Verb{co{ntent} raises an error during compilation whereas
\Verb|co{ntent| works.  Another issue with my suggestion above is this:


\documentclass{article}
\usepackage{fvextra}

\begin{document}

\Verb{w{o}r{k}s}
\Verb{b{r}eak{s}}

\end{document}

due to "[^\\]\\(?:\\\\\\\\\\)*" in the regexp.

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]