Selaa lähdekoodia

LaTeX export: Better handling of levels below the headline boundary

Outline levels below the headline boundary are now treated better, as
proper list.  The variable `org-export-latex-low-levels' can now also
be `itemize' or `enumerate', to get the corresponding list structure.
The new default is `itemize', to make it parallel with the behavior in
HTML.
Carsten Dominik 16 vuotta sitten
vanhempi
commit
4f70034a94
2 muutettua tiedostoa jossa 34 lisäystä ja 7 poistoa
  1. 7 0
      lisp/ChangeLog
  2. 27 7
      lisp/org-export-latex.el

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2009-03-21  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-export-latex.el (org-export-latex-low-levels): More options
+	for how to process lower levels in LaTeX.
+	(org-export-latex-subcontent): Better treatment for lists as a
+	means of publishing lower levels.
+
 2009-03-20  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-03-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org.el (org-set-font-lock-defaults): Use new checkbox face.
 	* org.el (org-set-font-lock-defaults): Use new checkbox face.

+ 27 - 7
lisp/org-export-latex.el

@@ -215,18 +215,20 @@ Each cell is of the forma \( \"option\" . \"package\" \)."
   :group 'org-export-latex
   :group 'org-export-latex
   :type 'alist)
   :type 'alist)
 
 
-(defcustom org-export-latex-low-levels 'description
+(defcustom org-export-latex-low-levels 'itemize
   "How to convert sections below the current level of sectioning.
   "How to convert sections below the current level of sectioning.
 This is specified by the `org-export-headline-levels' option or the
 This is specified by the `org-export-headline-levels' option or the
 value of \"H:\" in Org's #+OPTION line.
 value of \"H:\" in Org's #+OPTION line.
 
 
-This can be either nil (skip the sections), 'description (convert
-the sections as descriptive lists) or a string to be used instead
-of \\section{%s}. In this latter case, the %s stands here for the
-inserted headline and is mandatory."
+This can be either nil (skip the sections), `description', `itemize',
+or `enumerate' (convert the sections as the corresponding list type), or
+a string to be used instead of \\section{%s}.  In this latter case,
+the %s stands here for the inserted headline and is mandatory."
   :group 'org-export-latex
   :group 'org-export-latex
   :type '(choice (const :tag "Ignore" nil)
   :type '(choice (const :tag "Ignore" nil)
 		 (symbol :tag "Convert as descriptive list" description)
 		 (symbol :tag "Convert as descriptive list" description)
+		 (symbol :tag "Convert as descriptive list" itemize)
+		 (symbol :tag "Convert as descriptive list" enumerate)
 		 (string :tag "Use a section string" :value "\\subparagraph{%s}")))
 		 (string :tag "Use a section string" :value "\\subparagraph{%s}")))
 
 
 (defcustom org-export-latex-list-parameters
 (defcustom org-export-latex-list-parameters
@@ -674,13 +676,31 @@ If NUM, export sections as numerical sections."
      ;; At a level under the hl option: we can drop this subsection
      ;; At a level under the hl option: we can drop this subsection
      ((> level org-export-latex-sectioning-depth)
      ((> level org-export-latex-sectioning-depth)
       (cond ((eq org-export-latex-low-levels 'description)
       (cond ((eq org-export-latex-low-levels 'description)
-	     (insert (format "\\begin{description}\n\n\\item[%s]%s\n\n"
+	     (if (string-match "% ends low level$"
+			       (buffer-substring (point-at-bol 0) (point)))
+		 (delete-region (point-at-bol 0) (point))
+	       (insert "\\begin{description}\n"))
+	     (insert (format "\n\\item[%s]%s~\n\n"
 			     heading
 			     heading
 			     (if label (format "\\label{%s}" label) "")))
 			     (if label (format "\\label{%s}" label) "")))
 	     (insert (org-export-latex-content content))
 	     (insert (org-export-latex-content content))
 	     (cond ((stringp subcontent) (insert subcontent))
 	     (cond ((stringp subcontent) (insert subcontent))
 		   ((listp subcontent) (org-export-latex-sub subcontent)))
 		   ((listp subcontent) (org-export-latex-sub subcontent)))
-	     (insert "\\end{description}\n"))
+	     (insert "\\end{description} % ends low level\n"))
+	    ((memq org-export-latex-low-levels '(itemize enumerate))
+	     (if (string-match "% ends low level$"
+			       (buffer-substring (point-at-bol 0) (point)))
+		 (delete-region (point-at-bol 0) (point))
+	       (insert (format "\\begin{%s}\n"
+			       (symbol-name org-export-latex-low-levels))))
+	     (insert (format "\n\\item %s\\\\\n%s\n"
+			     heading
+			     (if label (format "\\label{%s}" label) "")))
+	     (insert (org-export-latex-content content))
+	     (cond ((stringp subcontent) (insert subcontent))
+		   ((listp subcontent) (org-export-latex-sub subcontent)))
+	     (insert (format "\\end{%s} %% ends low level\n"
+			     (symbol-name org-export-latex-low-levels))))
 	    ((stringp org-export-latex-low-levels)
 	    ((stringp org-export-latex-low-levels)
 	     (insert (format org-export-latex-low-levels heading) "\n")
 	     (insert (format org-export-latex-low-levels heading) "\n")
 	     (when label (insert (format "\\label{%s}\n" label)))
 	     (when label (insert (format "\\label{%s}\n" label)))