From 3d1ff31b604666bd3fddc04ac942ac5179e34f86 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 26 May 2009 17:04:10 +0200 Subject: [PATCH] LaTeX export: Fix \nbsp, 2nd attempt --- lisp/org-latex.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 7d3a07913..0116e44cd 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1549,9 +1549,13 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; Protect LaTeX entities (goto-char (point-min)) - (while (re-search-forward org-latex-entities-regexp nil t) - (add-text-properties (match-beginning 0) (match-end 0) - '(org-protected t))) + (let (a) + (while (re-search-forward org-latex-entities-regexp nil t) + (if (setq a (assoc (match-string 0) org-latex-entities-exceptions)) + (replace-match (org-add-props (nth 1 a) nil 'org-protected t) + t t) + (add-text-properties (match-beginning 0) (match-end 0) + '(org-protected t))))) ;; Replace radio links (goto-char (point-min)) @@ -1731,6 +1735,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "\\medskip" "\\multicolumn" "\\multiput" + ("\\nbsp" "~") "\\newcommand" "\\newcounter" "\\newenvironment" @@ -1802,9 +1807,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "\\vspace") "A list of LaTeX commands to be protected when performing conversion.") +(defvar org-latex-entities-exceptions nil) + (defconst org-latex-entities-regexp (let (names rest) (dolist (x org-latex-entities) + (when (consp x) + (add-to-list 'org-latex-entities-exceptions x) + (setq x (car x))) (if (string-match "[a-z][A-Z]$" x) (push x names) (push x rest)))