Browse Source

The the problem of partial name matches with LaTeX entities.

Carsten Dominik 16 years ago
parent
commit
79e0ca32d2
2 changed files with 14 additions and 1 deletions
  1. 4 0
      lisp/ChangeLog
  2. 10 1
      lisp/org-export-latex.el

+ 4 - 0
lisp/ChangeLog

@@ -1,3 +1,7 @@
+2008-10-18  Carsten Dominik  <dominik@science.uva.nl>
+
+	* org-export-latex.el (org-latex-entities-regexp): New constant.
+
 2008-10-17  Carsten Dominik  <dominik@science.uva.nl>
 
 	* org-export-latex.el (org-export-latex-treat-sub-super-char):

+ 10 - 1
lisp/org-export-latex.el

@@ -1206,7 +1206,7 @@ If TIMESTAMPS, convert timestamps, otherwise delete them."
 
   ;; Protect LaTeX entities
   (goto-char (point-min))
-  (while (re-search-forward (regexp-opt org-latex-entities) nil t)
+  (while (re-search-forward org-latex-entities-regexp nil t)
     (add-text-properties (match-beginning 0) (match-end 0)
 			 '(org-protected t)))
 
@@ -1451,6 +1451,15 @@ If TIMESTAMPS, convert timestamps, otherwise delete them."
    "\\vspace")
  "A list of LaTeX commands to be protected when performing conversion.")
 
+(defconst org-latex-entities-regexp
+  (let (names rest)
+    (dolist (x org-latex-entities)
+      (if (string-match "[a-z][A-Z]$" x)
+	  (push x names)
+	(push x rest)))
+    (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)"
+	    "\\|\\(" (regexp-opt (nreverse rest)) "\\)")))
+
 (provide 'org-export-latex)
 
 ;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad