From 4f70034a9441cb67c9e7aa8d17ed9967dc52442e Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 21 Mar 2009 13:12:07 +0100 Subject: [PATCH] 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. --- lisp/ChangeLog | 7 +++++++ lisp/org-export-latex.el | 34 +++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d01c94b9b..1632c6d12 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2009-03-21 Carsten Dominik + + * 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 * org.el (org-set-font-lock-defaults): Use new checkbox face. diff --git a/lisp/org-export-latex.el b/lisp/org-export-latex.el index 2cbd31326..2ad7f4cc2 100644 --- a/lisp/org-export-latex.el +++ b/lisp/org-export-latex.el @@ -215,18 +215,20 @@ Each cell is of the forma \( \"option\" . \"package\" \)." :group 'org-export-latex :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. This is specified by the `org-export-headline-levels' option or the 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 :type '(choice (const :tag "Ignore" nil) (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}"))) (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 ((> level org-export-latex-sectioning-depth) (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 (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 "\\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) (insert (format org-export-latex-low-levels heading) "\n") (when label (insert (format "\\label{%s}\n" label)))