There's a small bug in rendering the entities when org-pretty-entities is on (I get the feeling that org-pretty-entities is not a very commonly-used feature).  The entities \sup1 \sup2 \sup3 and \there4 are not rendered properly.  The regex detecting entities apparently doesn't catch numbers at the end, except for the special case of fractions.  I've added the others to the special-casing and attach a patch for it; I hope I managed to include the changelog properly (is git format-patch --attach the way to go?).


Also attached is another patch that might or might not be useful.  Sometimes it can be a problem when you can't type, say, asterisks around a word when you NEED asterisks around the word, not a boldface word (I'd been getting around it by using Unicode characters that look like asterisks, like ∗).  The way to do it right is to use the \ast entity, which expands to the right thing but doesn't affect formatting.  There's also already a \tilde entity, to allow putting in tildes without accidentally setting something verbatim.  I added entities for the remaining markup characters: \plus, \under, \equal, and \slash.  \under might be particularly handy when avoiding subscripting (which raises the question of if there should be an \asciicirc (or something) entity for ^ also).


~mark

>From 5070e37aaae6f952bab022c71212fabb7549105e Mon Sep 17 00:00:00 2001
From: Mark Shoulson <m...@kli.org>
Date: Tue, 8 May 2012 15:15:10 -0400
Subject: [PATCH] Fix for displaying certain "pretty" entities
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.7.6"

This is a multi-part message in MIME format.
--------------1.7.7.6
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


* org.el (org-fontify-entities): fix bug: The entities \sup[123] and
\there4 were not "prettified" when org-pretty-entities was enabled.

TINYCHANGE
---
 lisp/org.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


--------------1.7.7.6
Content-Type: text/x-patch; name="0001-Fix-for-displaying-certain-pretty-entities.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Fix-for-displaying-certain-pretty-entities.patch"

diff --git a/lisp/org.el b/lisp/org.el
index 66f9c3e..1d2955f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5954,7 +5954,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
     (when org-pretty-entities
       (catch 'match
 	(while (re-search-forward
-		"\\\\\\(frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]\n]\\)"
+		"\\\\\\(there4\\|sup[123]\\|frac[13][24]\\|[a-zA-Z]+\\)\\($\\|{}\\|[^[:alpha:]\n]\\)"
 		limit t)
 	  (if (and (not (org-in-indented-comment-line))
 		   (setq ee (org-entity-get (match-string 1)))

--------------1.7.7.6--


>From 58d18562f39ed64a547fa2d60510cae5983bcbef Mon Sep 17 00:00:00 2001
From: Mark Shoulson <m...@kli.org>
Date: Tue, 8 May 2012 15:22:48 -0400
Subject: [PATCH] Add entities for /, +, _, =
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.7.6"

This is a multi-part message in MIME format.
--------------1.7.7.6
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


* org-entities.el (org-entities): add new entities for characters
which could cause formatting changes if typed directly.
---
 lisp/org-entities.el |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


--------------1.7.7.6
Content-Type: text/x-patch; name="0001-Add-entities-for-_.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Add-entities-for-_.patch"

diff --git a/lisp/org-entities.el b/lisp/org-entities.el
index 8b5b3f3..fce3b68 100644
--- a/lisp/org-entities.el
+++ b/lisp/org-entities.el
@@ -260,6 +260,10 @@ loaded, add these packages to `org-export-latex-packages-alist'."
     ("lt" "\\textless{}" nil "&lt;" "<" "<" "<")
     ("gt" "\\textgreater{}" nil "&gt;" ">" ">" ">")
     ("tilde" "\\~{}" nil "&tilde;" "~" "~" "~")
+    ("slash" "/" nil "/" "/" "/" "/")
+    ("plus" "+" nil "+" "+" "+" "+")
+    ("under" "\\_" nil "_" "_" "_" "_")
+    ("equal" "=" nil "=" "=" "=" "=")
     ("dagger" "\\textdagger{}" nil "&dagger;" "[dagger]" "[dagger]" "†")
     ("Dagger" "\\textdaggerdbl{}" nil "&Dagger;" "[doubledagger]" "[doubledagger]" "‡")
 

--------------1.7.7.6--


Reply via email to