emacs-orgmode
[Top][All Lists]
Advanced

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

[O] html-encode in mathjax latex fragments


From: Eric Schulte
Subject: [O] html-encode in mathjax latex fragments
Date: Sun, 29 Jun 2014 14:41:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

I noticed equations with "<"'s weren't displaying correctly in HTML
export using mathjax.  The attached patch fixes this by html-encoding
latex fragments for mathjax HTML export.  I imagine this change would be
generally useful and could be applied to master.

Best,
Eric

>From 8c4efca17f2a6fbc836c5a8b6b0f628b6c9fff33 Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
Date: Sun, 29 Jun 2014 14:38:03 -0400
Subject: [PATCH] html-encode text in mathjax latex fragments

* lisp/ox-html.el (org-html-format-latex): Html-encode text in mathjax
  latex fragments.
---
 lisp/ox-html.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index df392a9..03037f5 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2610,7 +2610,8 @@ a symbol among `mathjax', `dvipng', `imagemagick', 
`verbatim' nil
 and t.  See `org-html-with-latex' for more information.  INFO is
 a plist containing export properties."
   (let ((cache-relpath "") (cache-dir ""))
-    (unless (eq processing-type 'mathjax)
+    (if (eq processing-type 'mathjax)
+       (setq latex-frag (org-html-encode-plain-text latex-frag))
       (let ((bfn (or (buffer-file-name)
                     (make-temp-name
                      (expand-file-name "latex" temporary-file-directory))))
-- 
2.0.0

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)

reply via email to

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