From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: html-encode in mathjax latex fragments Date: Sun, 29 Jun 2014 14:41:03 -0400 Message-ID: <87pphrh83k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1K39-0003zY-9y for emacs-orgmode@gnu.org; Sun, 29 Jun 2014 14:42:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1K34-0004Iz-Dk for emacs-orgmode@gnu.org; Sun, 29 Jun 2014 14:42:03 -0400 Received: from mail-qc0-x22c.google.com ([2607:f8b0:400d:c01::22c]:54171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1K34-0004Il-A2 for emacs-orgmode@gnu.org; Sun, 29 Jun 2014 14:41:58 -0400 Received: by mail-qc0-f172.google.com with SMTP id o8so6253457qcw.17 for ; Sun, 29 Jun 2014 11:41:57 -0700 (PDT) Received: from bagel (pool-74-111-105-28.pitbpa.fios.verizon.net. [74.111.105.28]) by mx.google.com with ESMTPSA id r7sm22902329qas.5.2014.06.29.11.41.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jun 2014 11:41:56 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Mailing List --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-html-encode-text-in-mathjax-latex-fragments.patch >From 8c4efca17f2a6fbc836c5a8b6b0f628b6c9fff33 Mon Sep 17 00:00:00 2001 From: Eric Schulte 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 --=-=-= Content-Type: text/plain -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw) --=-=-=--