From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: [PATCH] lists and exportation to latex Date: Mon, 14 Jun 2010 01:25:44 +0200 Message-ID: <87ljaitszr.wl%n.goaziou@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Mon_Jun_14_01:25:44_2010-1" Return-path: Received: from [140.186.70.92] (port=35224 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ONwYm-0004Zv-Gm for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 19:25:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ONwYl-0005Av-Dc for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 19:25:48 -0400 Received: from mail-ww0-f41.google.com ([74.125.82.41]:51167) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ONwYl-0005Ap-7Z for emacs-orgmode@gnu.org; Sun, 13 Jun 2010 19:25:47 -0400 Received: by wwb34 with SMTP id 34so3480618wwb.0 for ; Sun, 13 Jun 2010 16:25:46 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --Multipart_Mon_Jun_14_01:25:44_2010-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Mon_Jun_14_01:25:44_2010-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="0001-Fix-and-improve-list-exporting-to-latex.patch" Content-Transfer-Encoding: 7bit >From 2ab59460aee0dab79b199a3c0a9a144ef5e4a34f Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou 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 --Multipart_Mon_Jun_14_01:25:44_2010-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --Multipart_Mon_Jun_14_01:25:44_2010-1--