emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lists and exportation to latex
@ 2010-06-13 23:25 Nicolas Goaziou
  2010-06-14  7:40 ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2010-06-13 23:25 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

Hello,

Here is a patch making latex exporter smarter about lists.

Here is a (vicious) example of what can be exported now.

------------------------------------------------------------------
  1. A very long line with a mathematical environment at its end \(x =
     25 \)

     #+BEGIN_EXAMPLE
  3. three
  4. four
     #+END_EXAMPLE

  2. Another line
------------------------------------------------------------------

Exporting to html is still a problem though : it doesn't seem to use
org-list-to-html (and thus org-list-parse-list) from org-list.el.

-- Nicolas


[-- Attachment #2: 0001-Fix-and-improve-list-exporting-to-latex.patch --]
[-- Type: application/octet-stream, Size: 2441 bytes --]

From 2ab59460aee0dab79b199a3c0a9a144ef5e4a34f Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Mon, 14 Jun 2010 01:04:47 +0200
Subject: [PATCH] Fix and improve list exporting to latex.

* lisp/org-latex.el: items are no longer skipped when their first line
  ends on a protected element.
* lisp/org-list.el: protected environments looking like lists are not
  exported anymore.
---
 lisp/org-latex.el |   29 ++++++++++++++---------------
 lisp/org-list.el  |    2 +-
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index edc05c6..01a4b05 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2188,21 +2188,20 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
   "Convert plain text lists in current buffer into LaTeX lists."
   (let (res)
     (goto-char (point-min))
-    (while (re-search-forward org-list-beginning-re nil t)
-      (org-if-unprotected
-       (beginning-of-line)
-       (setq res (org-list-to-latex (org-list-parse-list t)
-				    org-export-latex-list-parameters))
-       (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]"
-			    res)
-	 (setq res (replace-match
-		    (concat (format "\\setcounter{enumi}{%d}"
-				    (1- (string-to-number
-					 (match-string 2 res))))
-			    "\n"
-			    (match-string 1 res))
-		    t t res)))
-       (insert res "\n")))))
+    (while (org-re-search-forward-unprotected org-list-beginning-re nil t)
+      (beginning-of-line)
+      (setq res (org-list-to-latex (org-list-parse-list t)
+				   org-export-latex-list-parameters))
+      (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]"
+			   res)
+	(setq res (replace-match
+		   (concat (format "\\setcounter{enumi}{%d}"
+				   (1- (string-to-number
+					(match-string 2 res))))
+			   "\n"
+			   (match-string 1 res))
+		   t t res)))
+      (insert res "\n"))))
 
 (defconst org-latex-entities
  '("\\!"
diff --git a/lisp/org-list.el b/lisp/org-list.el
index 938391d..2aacd09 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -1170,7 +1170,7 @@ sublevels as a list of strings."
 				    (match-beginning 0)) end))))
 	     (item (buffer-substring
 		    (point)
-		    (or (and (re-search-forward
+		    (or (and (org-re-search-forward-unprotected
 			      org-list-beginning-re end t)
 			     (goto-char (match-beginning 0)))
 			(goto-char end))))
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-06-15 16:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-13 23:25 [PATCH] lists and exportation to latex Nicolas Goaziou
2010-06-14  7:40 ` Nicolas Goaziou
2010-06-14 17:32   ` Eric Schulte
2010-06-14 18:10     ` Eric Schulte
2010-06-14 20:07       ` [PATCH] comments exporting Nicolas Goaziou
2010-06-14 21:36         ` Eric Schulte
2010-06-15 13:03           ` Nicolas Goaziou
2010-06-15 15:48             ` Eric Schulte
2010-06-15 16:32               ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).