[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Patch for latex export supporting nested emphasis
From: |
Robert Hennig |
Subject: |
[Orgmode] Patch for latex export supporting nested emphasis |
Date: |
Fri, 20 Aug 2010 16:30:19 +0200 |
User-agent: |
Thunderbird 1.5.0.8 (X11/20060911) |
Dear Orgmode maintainers,
I would like to provide a patch which allows nested emphasis
for the latex export. The problem of handling nested emphasis
was solved by applying the org-export-latex-fontify recursively.
The example
Now *you /can/ write* /nested/ */emphasis/ recursively!*
will be translated to:
Now \textbf{you \emph{can} write} \emph{nested}
\textbf{\emph{emphasis} recursively!}
Best regards, yours faithful
Robert Hennig
--- org-latex.el 2010-08-20 15:58:28.000000000 +0200
+++ org-latex.mod.el 2010-08-20 16:06:26.000000000 +0200
@@ -1795,8 +1795,24 @@
(defun org-export-latex-fontify ()
"Convert fontification to LaTeX."
+ ;; max recursive level set to 2,
+ ;; so one level of nested emphasis works
+ (org-export-latex-fontify-recursive 2)
+)
+
+(defun org-export-latex-fontify-recursive (reclevel)
+ "Convert fontification to LaTeX, recursive part."
(goto-char (point-min))
(while (re-search-forward org-emph-re nil t)
+ (if (> reclevel 1)
+ (let ((mdata (match-data)))
+ (unwind-protect
+ ;; now it is ok to change the original match data.
+ (save-excursion
+ (save-restriction
+ (narrow-to-region (match-beginning 4) (match-end 4))
+ (org-export-latex-fontify-recursive (1- reclevel))))
+ (set-match-data mdata))))
;; The match goes one char after the *string*, except at the end of a line
(let ((emph (assoc (match-string 3)
org-export-latex-emphasis-alist))
- [Orgmode] Patch for latex export supporting nested emphasis,
Robert Hennig <=