[Top][All Lists]

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

master 39e00622: Introduce face and keyword class for underlined text

From: Arash Esbati
Subject: master 39e00622: Introduce face and keyword class for underlined text
Date: Mon, 20 Jun 2022 08:03:54 -0400 (EDT)

branch: master
commit 39e006223516b15cf039923bb16c56e5a9070c08
Author: Arash Esbati <>
Commit: Arash Esbati <>

    Introduce face and keyword class for underlined text
    * doc/auctex.texi (Fontification of macros): Describe the keyword
    list `font-latex-match-underline-command-keywords'.  Add
    "underline-command" to description of user option
    * doc/changes.texi: Announce the new face.
    * font-latex.el (font-latex-built-in-keyword-classes): Introduce
    new keyword classs "underline-command" incl. the builtin macro.
    (font-latex-add-keywords): Adjust docstrings accordingly.
    (font-latex-underline-face): New face for underlined text.
    * style/ulem.el ("ulem"): Use new keyword class for macros
    provided by the package.
    Co-authored-by: Hendrik Rommeswinkel <>
    Copyright-paperwork-exempt: yes
 doc/auctex.texi  |  6 +++++-
 doc/changes.texi | 12 ++++++++++++
 font-latex.el    | 27 ++++++++++++++++++++++-----
 style/ulem.el    |  7 ++++---
 4 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index a2a04525..e673f1b3 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2211,6 +2211,7 @@ your own macros which are listed in the table below.
 @vindex font-latex-match-bold-command-keywords
 @vindex font-latex-match-italic-command-keywords
+@vindex font-latex-match-underline-command-keywords
 @vindex font-latex-match-math-command-keywords
 @vindex font-latex-match-type-command-keywords
 @vindex font-latex-match-bold-declaration-keywords
@@ -2223,6 +2224,9 @@ Face: @code{font-latex-bold-face}
 @item font-latex-match-italic-command-keywords
 Keywords for commands specifying an italic font.@*
 Face: @code{font-latex-italic-face}
+@item font-latex-match-underline-command-keywords
+Keywords for commands specifying an underlined text.@*
+Face: @code{font-latex-underline-face}
 @item font-latex-match-math-command-keywords
 Keywords for commands specifying a math font.@*
 Face: @code{font-latex-math-face}
@@ -2251,7 +2255,7 @@ entries are "warning", "variable", "biblatexnoarg", 
 "reference", "function" , "sectioning-0", "sectioning-1",
 "sectioning-2", "sectioning-3", "sectioning-4", "sectioning-5",
 "slide-title", "textual", "bold-command", "italic-command",
-"math-command", "type-command", "bold-declaration",
+"underline-command", "math-command", "type-command", "bold-declaration",
 "italic-declaration", "type-declaration".
 You can also get rid of certain keywords only.  For example if you want
diff --git a/doc/changes.texi b/doc/changes.texi
index c0294716..6c0a5723 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -11,6 +11,18 @@
 @heading News since last release
 @itemize @bullet
+@AUCTeX{} underlines the argument of macros which produce underlined text
+in the final product with @code{font-latex-underline-face}.  The
+corresponding keyword class is called @code{underline-command}.
+@ifset rawfile
+See the section for fontification of macros
+@end ifset
+@ifclear rawfile
+@xref{Fontification of macros}
+@end ifclear
+if you dislike this feature and wish to deactivate it.
 Support for the Sioyek document viewer is added.
diff --git a/font-latex.el b/font-latex.el
index 92b6047a..111d8e93 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -431,6 +431,9 @@ variable `font-latex-fontify-sectioning'." ',num)
      (("emph" "{") ("textit" "{") ("textsl" "{") ("mathit" "{"))
      font-latex-italic-face 1 command)
+    ("underline-command"
+     (("underline" "{"))
+     font-latex-underline-face 1 command)
      (("ensuremath" "|{\\"))
      font-latex-math-face 1 command)
@@ -481,9 +484,9 @@ Valid entries are \"warning\", \"variable\", 
 \"biblatex\", \"reference\", \"function\" , \"sectioning-0\",
 \"sectioning-1\", \"sectioning-2\", \"sectioning-3\",
 \"sectioning-4\", \"sectioning-5\", \"slide-title\", \"textual\",
-\"bold-command\", \"italic-command\", \"math-command\",
-\"type-command\", \"bold-declaration\", \"italic-declaration\",
+\"bold-command\", \"italic-command\", \"underline-command\",
+\"math-command\", \"type-command\", \"bold-declaration\",
+\"italic-declaration\", \"type-declaration\".
 You have to restart Emacs for a change of this variable to take effect."
   :group 'font-latex-keywords
@@ -913,8 +916,8 @@ symbols `warning', `variable', `reference', `biblatexnoarg',
 `biblatex', `function', `sectioning-0', `sectioning-1',
 `sectioning-2', `sectioning-3', `sectioning-4', `sectioning-5',
 `slide-title', `textual', `bold-command', `italic-command',
-`math-command', `type-command', `bold-declaration',
-`italic-declaration' or `type-declaration'.
+`underline-command', `math-command', `type-command',
+`bold-declaration', `italic-declaration' or `type-declaration'.
 The keywords will be added to the buffer-local list of keywords
 of the respective keyword class and necessary updates of the font
@@ -1143,6 +1146,20 @@ have changed."
   "Face used to highlight text to be typeset in italic."
   :group 'font-latex-highlighting-faces)
+(defface font-latex-underline-face
+  (let ((font '(:inherit underline)))
+    `((((class grayscale) (background light))
+       (:foreground "DimGray" ,@font))
+      (((class grayscale) (background dark))
+       (:foreground "LightGray" ,@font))
+      (((class color) (background light))
+       (:foreground "DarkOliveGreen" ,@font))
+      (((class color) (background dark))
+       (:foreground "OliveDrab" ,@font))
+      (t (,@font))))
+  "Face used to highlight text to be underlined."
+  :group 'font-latex-highlighting-faces)
 (defface font-latex-math-face
   (let ((font '(:inherit underline)))
     `((((class grayscale) (background light))
diff --git a/style/ulem.el b/style/ulem.el
index cfb6105e..fa9cefb0 100644
--- a/style/ulem.el
+++ b/style/ulem.el
@@ -69,14 +69,15 @@
      ;; Tell font-lock about the update.
      (font-latex-add-keywords '(("useunder" "{{{"))
+     (font-latex-add-keywords '(("sout" "{")
+                                ("xout" "{"))
+                              'textual)
      (font-latex-add-keywords '(("uline" "{")
                                 ("uuline" "{")
                                 ("uwave" "{")
-                                ("sout" "{")
-                                ("xout" "{")
                                 ("dashuline" "{")
                                 ("dotuline" "{"))
-                              'textual)))
+                              'underline-command)))
 (defvar LaTeX-ulem-fontdecl

reply via email to

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