[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/engrave-faces d6bc222841: LaTeX: allow for tex/latex on
From: |
ELPA Syncer |
Subject: |
[elpa] externals/engrave-faces d6bc222841: LaTeX: allow for tex/latex only maths comments |
Date: |
Wed, 11 May 2022 10:57:39 -0400 (EDT) |
branch: externals/engrave-faces
commit d6bc2228418941b9bee525cf588714569f6edb5d
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>
LaTeX: allow for tex/latex only maths comments
---
engrave-faces-latex.el | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/engrave-faces-latex.el b/engrave-faces-latex.el
index d2465e8e45..4d209356b1 100644
--- a/engrave-faces-latex.el
+++ b/engrave-faces-latex.el
@@ -22,10 +22,22 @@ When preset, short commands are generated for
`engrave-faces-preset-styles'."
:group 'engrave-faces)
(defcustom engrave-faces-latex-mathescape nil
- "Whether $ characters in comments should be allowed.
-This is intended to be used with fvextra's mathescape option, and
-only applies to text set with `font-lock-comment-face' including
-at least two $s."
+ "Whether maths characters in comments should be allowed.
+
+When nil, all potential maths (both \"$tex$\" and
+\"\\(latex\\)\") is protected by
+`engrave-faces-latex--protect-content'. Three non-nil symbols are
+supported:
+- latex, in which case the content of LaTeX maths is left unprotected
+- tex, in which case the content of TeX dollar-delimited maths is left
+ unprotected
+- t, in which case LaTeX and TeX maths are supported
+
+This only affects text set with `font-lock-comment-face'.
+
+For TeX maths to be supported, fvextra's mathescape option must
+also be applied. This is done automatically when generating a
+standalone document."
:type 'boolean
:group 'engrave-faces)
@@ -105,8 +117,12 @@ See `engrave-faces-preset-styles' and
`engrave-faces-latex-output-style'."
nil t))
(defun engrave-faces-latex--protect-content-mathescape (content)
- (let ((dollar-maths (string-match-p "\\$.+\\$" content))
- (paren-maths (string-match-p "\\\\(.+\\\\)" content)))
+ (let ((dollar-maths
+ (and (memq engrave-faces-latex-mathescape '(t tex TeX))
+ (string-match-p "\\$.+\\$" content)))
+ (paren-maths
+ (and (memq engrave-faces-latex-mathescape '(t latex LaTeX))
+ (string-match-p "\\\\(.+\\\\)" content))))
(replace-regexp-in-string
(cond
(dollar-maths "^\\([^$]*\\)\\(\\$.+\\$\\)\\([^$]*\\)$")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/engrave-faces d6bc222841: LaTeX: allow for tex/latex only maths comments,
ELPA Syncer <=