From 4636a4d5e4fc33216ebafbe828df0844ed8d0798 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Thu, 3 Jul 2008 10:36:32 -0700 Subject: [PATCH] Fix bug with export of tags in headlines. --- ORGWEBPAGE/index.org | 3 ++- lisp/org-export-latex.el | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ORGWEBPAGE/index.org b/ORGWEBPAGE/index.org index da00670bf..c6325e35b 100644 --- a/ORGWEBPAGE/index.org +++ b/ORGWEBPAGE/index.org @@ -58,7 +58,8 @@ http://repo.or.cz/w/org-mode.git There are several alternative distrbutions of Org: - The [[http://savannah.gnu.org/cvs/%3Fgroup%3Demacs][Emacs CVS]] contains a recent version - - There is a [[http://packages.debian.org/sid/main/org-mode][Debian package]] by Sebastien Delafond + - There is also a package on [[http://aur.archlinux.org/packages.php?do_Details&ID=18206][Archlinux]], by Jiyunatori. + - The [[http://packages.debian.org/sid/main/org-mode][Debian package]] is maintainned by Sebastien Delafond - Mark A. Hershberger has made an [[https://launchpad.net/~hexmode/+archive][Ubuntu package]] for Org, but that seems to be out of date. diff --git a/lisp/org-export-latex.el b/lisp/org-export-latex.el index ae876548e..878060f0e 100644 --- a/lisp/org-export-latex.el +++ b/lisp/org-export-latex.el @@ -762,11 +762,22 @@ org-protect property." (replace-match "") (replace-match (format "\\texttt{%s}" (match-string 0)) t t))) ;; convert tags - (when (re-search-forward "\\(:[a-zA-Z0-9]+\\)+:" nil t) + (when (re-search-forward "\\(:[a-zA-Z0-9_@]+\\)+:" nil t) (if (or (not org-export-with-tags) (plist-get remove-list :tags)) (replace-match "") - (replace-match (format "\\texttt{%s}" (match-string 0)) t t))))) + (replace-match + (org-export-latex-protect-string + (format "\\texttt{%s}" (save-match-data + (org-quote-chars (match-string 0))))) + t t))))) + +(defun org-quote-chars (s) + (let ((start 0)) + (while (string-match "_" s start) + (setq start (+ 2 (match-beginning 0)) + s (replace-match "\\_" t t s)))) + s) (defun org-export-latex-fontify-headline (string) "Fontify special words in string." @@ -777,10 +788,10 @@ org-protect property." (goto-char (point-min)) (when (plist-get org-export-latex-options-plist :emphasize) (org-export-latex-fontify)) - (org-export-latex-special-chars - (plist-get org-export-latex-options-plist :sub-superscript)) (org-export-latex-keywords-maybe org-export-latex-remove-from-headlines) + (org-export-latex-special-chars + (plist-get org-export-latex-options-plist :sub-superscript)) (org-export-latex-links) (org-trim (buffer-substring-no-properties (point-min) (point-max))))) -- 2.11.4.GIT