





















* font-latex.el (font-latex-set-syntactic-keywords): Fix fontification of inline verbatim macros when the macro itself is followed by a space. The space is gobbled correctly since LaTeX release 2020-10-01. * tests/latex/font-latex-test.el (font-latex-general-fontification): Adjust test accordingly.
diff --git a/font-latex.el b/font-latex.el
index 7873a4a5681..0908d78e8a0 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1,6 +1,6 @@
;;; font-latex.el --- LaTeX fontification for Font Lock mode. -*- lexical-binding: t; -*-
-;; Copyright (C) 1996-2025 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2026 Free Software Foundation, Inc.
;; Authors: Peter S. Galbraith <psg@debian.org>
;; Simon Marshall <Simon.Marshall@esrin.esa.it>
@@ -1091,6 +1091,10 @@ have changed."
(add-to-list
'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)"
+ ;; Since LaTeX release 2020-10-01, spaces after \verb
+ ;; macro are gobbled like with other macros (see
+ ;; ltnews32.pdf), so deal with them:
+ "[ \t]*"
;; Some macros take an optional argument. This is
;; the same line as above for environments.
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
@@ -1109,6 +1113,8 @@ have changed."
(add-to-list
'font-latex-syntactic-keywords
`(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)"
+ ;; Spaces are allowed after macros as usual:
+ "[ \t]*"
;; Some macros take an optional argument. This is
;; the same line as above for environments.
"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"
@@ -1,6 +1,6 @@
;;; font-latex-test.el --- tests for font-latex -*- lexical-binding: t; -*-
-;; Copyright (C) 2020-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2020-2026 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
@@ -115,6 +115,7 @@ $a$")
\\section{Macros}
Inline verbatim test: \\verb|x|
+Inline verbatim test: \\verb* |x|
Inline math test: $x$, \\(x\\)
Marginpar test: \\marginpar{x}
Sedate macro test: \\sedate
@@ -215,6 +216,9 @@ x
(search-forward "\\verb|")
(should (font-latex-faces-present-p 'font-latex-verbatim-face))
(end-of-line)
+ (search-forward "\\verb* |")
+ (should (font-latex-faces-present-p 'font-latex-verbatim-face))
+ (end-of-line)
;; Test for inline math:
(search-forward "$")
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。