Browse Source

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.

Thanks to Nicolas Goaziou <n.goaziou@gmail.com> for this patch.
Bastien Guerry 15 years ago
parent
commit
47996c02cb
2 changed files with 15 additions and 16 deletions
  1. 14 15
      lisp/org-latex.el
  2. 1 1
      lisp/org-list.el

+ 14 - 15
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
  '("\\!"

+ 1 - 1
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))))