GNU bug report logs -
#41559
texmathp reports false negatives
Previous Next
Reported by: TEC <tec <at> tecosaur.com>
Date: Wed, 27 May 2020 05:56:01 UTC
Severity: normal
Tags: fixed
Done: Ikumi Keita <ikumi <at> ikumi.que.jp>
Bug is archived. No further changes may be made.
Full log
Message #26 received at 41559 <at> debbugs.gnu.org (full text, mbox):
Hi Timothy,
>>>>> TEC <tec <at> tecosaur.com> writes:
> That's great to hear. Thank you very much for taking a look at this.
> With the new org-edit-special for inline LaTeX fragments, having this
> work smoothly would be marvelous :)
> If you'd also be willing to check out the
> \[
> a
> \]
> case as well, that would be similarly appriciated.
I installed a fix in the git repo. You can try it out with the following
patch.
Regards,
Ikumi Keita
diff --git a/texmathp.el b/texmathp.el
index ba5aba39..723623bc 100644
--- a/texmathp.el
+++ b/texmathp.el
@@ -185,13 +185,11 @@ customize (customize calls it when setting the variable)."
((memq type '(sw-toggle)) 'togglers)))
(set var (cons (car entry) (symbol-value var))))
(setq texmathp-onoff-regexp
- (concat "[^\\\\]\\("
- (mapconcat 'regexp-quote switches "\\|")
- "\\)")
+ (concat "\\(?:[^\\\\]\\|\\`\\)"
+ (regexp-opt switches t))
texmathp-toggle-regexp
- (concat "\\([^\\\\\\$]\\|\\`\\)\\("
- (mapconcat 'regexp-quote togglers "\\|")
- "\\)"))))
+ (concat "\\([^\\\\\\$]\\|\\`\\)"
+ (regexp-opt togglers t)))))
(defcustom texmathp-tex-commands nil
"List of environments and macros influencing (La)TeX math mode.
@@ -287,14 +285,17 @@ See the variable `texmathp-tex-commands' about which commands are checked."
;; Select the nearer match
(and env-match (setq match env-match))
- (and mac-match (> (cdr mac-match) (cdr match)) (setq match mac-match))
+ ;; Use `>=' instead of `>' in case called inside \ensuremath{..}
+ ;; beginning just at (point-min).
+ (and mac-match (>= (cdr mac-match) (cdr match)) (setq match mac-match))
(setq math-on (memq (nth 1 (assoc (car match) texmathp-tex-commands1))
'(env-on arg-on)))
;; Check for switches
(and (not math-on)
(setq sw-match (texmathp-match-switch bound))
- (> (cdr sw-match) (cdr match))
+ ;; Use `>=' instead of `>' by similar reason as above. (bug#41559)
+ (>= (cdr sw-match) (cdr match))
(eq (nth 1 (assoc (car sw-match) texmathp-tex-commands1)) 'sw-on)
(setq match sw-match math-on t))
This bug report was last modified 5 years and 71 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.