Hi Keita,

Ikumi Keita <[email protected]> writes:

>>>>>> Arash Esbati <[email protected]> writes:
>>
>> Footnotes:
>> [1]  From hyperref.pdf, section 6 Additional user macros.
>
> Hmm, strange. The same portion of hyperref-doc.pdf (not hyperref.pdf,
> though) reads

Sorry, my bad, I meant hyperref-doc.pdf.

> ... The special characters # and ~ ...
>
> for me. The second symbol is not "%", but "~".
>
> I haven't updated my TeX Live 2022 installation yet, so maybe the latest
> version is revised in such a way?

Yes, this is the corresponding bug report:

  https://github.com/latex3/hyperref/issues/249

>> You can have things like '%20' in the URL which would then break
>> fontification if not treated verbatim.
>
> In fact "%" is treaded verbatim in the actual pdflatex run as you say,
> so I realized that hyperref.sty treats "%", in addtion to "#" and "~",
> as special. Hmm, this is diffcult...

How about this:

--8<---------------cut here---------------start------------->8---
diff --git a/font-latex.el b/font-latex.el
index b78cf58a..bcb27b64 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---

Best, Arash

Reply via email to