[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Accepted] [O] Allow mixed export of numbered and unnumbered sections in
From: |
Bastien Guerry |
Subject: |
[Accepted] [O] Allow mixed export of numbered and unnumbered sections in LaTeX |
Date: |
Wed, 23 Mar 2011 15:04:33 +0100 (CET) |
Patch 710 (http://patchwork.newartisans.com/patch/710/) is now "Accepted".
Maintainer comment: none
This relates to the following submission:
http://mid.gmane.org/%3Cm3aagn2pi7.fsf_-_%40e4300lm.epcc.ed.ac.uk%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Allow mixed export of numbered and unnumbered sections in LaTeX
> Date: Tue, 22 Mar 2011 19:26:14 -0000
> From: Lawrence Mitchell <address@hidden>
> X-Patchwork-Id: 710
> Message-Id: <address@hidden>
> To: address@hidden
>
> * lisp/org-latex.el (org-export-latex-subcontent): Deal specially with
> the case that NUM is an integer.
>
> We would sometimes like to have numbered \sections in LaTeX export but
> unnumbered \subsections and so forth. That is, use the starred
> equivalents for all sectioning commands below a certain level.
> Previously, the num: option specification could only specify whether
> sections should be numbered or unnumbered at all levels. We now treat
> an integer value specially, if num:N is supplied then the highest N
> levels are numbered, and lower levels are exported without numbering.
>
> ---
> lisp/org-latex.el | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> [...]
> Wouldn't it be nice if #+OPTIONS: num:2 exported
> \section{foo}
> \subsection{bar}
> \subsubsection*{baz}
>
> It turns out the patch is relatively straightforward. I haven't
> included a doc update, but could do so if required.
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index fbdeb5e..7a3c629 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1151,7 +1151,9 @@ and its content."
>
> (defun org-export-latex-subcontent (subcontent num)
> "Export each cell of SUBCONTENT to LaTeX.
> -If NUM, export sections as numerical sections."
> +If NUM is non-nil export numbered sections, otherwise use unnumbered
> +sections. If NUM is an integer, export the highest NUM levels as
> +numbered sections and lower levels as unnumbered sections."
> (let* ((heading (cdr (assoc 'heading subcontent)))
> (level (- (cdr (assoc 'level subcontent))
> org-export-latex-add-level))
> @@ -1187,6 +1189,9 @@ If NUM, export sections as numerical sections."
> ;; Normal conversion
> ((<= level depth)
> (let* ((sec (nth (1- level) sectioning))
> + (num (if (integerp num)
> + (>= num level)
> + num))
> start end)
> (if (consp (cdr sec))
> (setq start (nth (if num 0 2) sec)
>
- [O] unnumbered subsections in latex export, Suvayu Ali, 2011/03/22
- [O] Re: unnumbered subsections in latex export, Sébastien Vauban, 2011/03/22
- Re: [O] Re: unnumbered subsections in latex export, Nick Dokos, 2011/03/22
- Re: [O] Re: unnumbered subsections in latex export, Suvayu Ali, 2011/03/22
- Re: [O] Re: unnumbered subsections in latex export, Nick Dokos, 2011/03/22
- [O] [PATCH] Allow mixed export of numbered and unnumbered sections in HTML, Lawrence Mitchell, 2011/03/23
- [Accepted] [O] Allow mixed export of numbered and unnumbered sections in HTML, Bastien Guerry, 2011/03/23
- Re: [Accepted] [O] Allow mixed export of numbered and unnumbered sections in HTML, Nick Dokos, 2011/03/23
- Re: [Accepted] [O] Allow mixed export of numbered and unnumbered sections in HTML, Suvayu Ali, 2011/03/23
- Re: [O] Re: unnumbered subsections in latex export, Bastien, 2011/03/23
- Re: [O] Re: unnumbered subsections in latex export, Nick Dokos, 2011/03/23