summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-11-06 23:01:03 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-11-06 23:01:03 +0100
commitcdfc96f47c62b7253e7093e3bb9328af38d5c91c (patch)
treeb391b2c2aed05c09a78c0675af2c4ff9057f0358
parent265e5b9984818f76dea8f5147af0c4a939cf457b (diff)
downloadorg-mode-cdfc96f47c62b7253e7093e3bb9328af38d5c91c.tar.gz
ox-latex: Do not merge consecutive $$...$$
* lisp/ox-latex.el (org-latex-latex-fragment): Since $$..$$ snippets are not wrapped within a math-block, do not remove markers. (org-latex--wrap-latex-math-block): Do not wrap $$...$$ LaTeX snippets.
-rw-r--r--lisp/ox-latex.el25
1 files changed, 11 insertions, 14 deletions
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index f545c9c..bbf7f41 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2177,10 +2177,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(let ((value (org-element-property :value latex-fragment)))
;; Trim math markers since the fragment is enclosed within
;; a latex-math-block object anyway.
- (cond ((string-match "\\`\\(\\$\\{1,2\\}\\)\\([^\000]*\\)\\1\\'" value)
- (match-string 2 value))
- ((string-match "\\`\\\\(\\([^\000]*\\)\\\\)\\'" value)
- (match-string 1 value))
+ (cond ((string-match-p "\\`\\$[^$]" value) (substring value 1 -1))
+ ((string-prefix-p "\\(" value) (substring value 2 -2))
(t value))))
@@ -2613,16 +2611,15 @@ channel."
DATA is a parse tree or a secondary string. INFO is a plist
containing export options. Modify DATA by side-effect and return it."
(let ((valid-object-p
- (function
- ;; Non-nil when OBJ can be added to the latex math block.
- (lambda (obj)
- (case (org-element-type obj)
- (entity (org-element-property :latex-math-p obj))
- (latex-fragment
- (let ((value (org-element-property :value obj)))
- (or (org-string-match-p "\\`\\\\([^\000]*\\\\)\\'" value)
- (org-string-match-p "\\`\\$[^\000]*\\$\\'" value))))
- ((subscript superscript) t))))))
+ ;; Non-nil when OBJ can be added to the latex math block.
+ (lambda (obj)
+ (pcase (org-element-type obj)
+ (`entity (org-element-property :latex-math-p obj))
+ (`latex-fragment
+ (let ((value (org-element-property :value obj)))
+ (or (string-prefix-p "\\(" value)
+ (string-match-p "\\`\\$[^$]" value))))
+ ((or `subscript `superscript) t)))))
(org-element-map data '(entity latex-fragment subscript superscript)
(lambda (object)
;; Skip objects already wrapped.