emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>
Subject: [PATCH] lists and exportation to latex
Date: Mon, 14 Jun 2010 01:25:44 +0200	[thread overview]
Message-ID: <87ljaitszr.wl%n.goaziou@gmail.com> (raw)

[-- 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

             reply	other threads:[~2010-06-13 23:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-13 23:25 Nicolas Goaziou [this message]
2010-06-14  7:40 ` [PATCH] lists and exportation to latex 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljaitszr.wl%n.goaziou@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).