From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] Export: Override headline numbering via properties Date: Thu, 23 May 2013 21:03:27 +0200 Message-ID: <8761y98qo0.fsf@gmail.com> References: <87ppwvtnbw.fsf@gmail.com> <87hai7taj7.fsf@gmail.com> <87wqqywawa.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfanQ-0007GM-Do for emacs-orgmode@gnu.org; Thu, 23 May 2013 15:03:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfanO-0002fs-Rr for emacs-orgmode@gnu.org; Thu, 23 May 2013 15:03:28 -0400 Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]:45687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfanO-0002fi-LZ for emacs-orgmode@gnu.org; Thu, 23 May 2013 15:03:26 -0400 Received: by mail-we0-f182.google.com with SMTP id q57so2058271wes.41 for ; Thu, 23 May 2013 12:03:25 -0700 (PDT) In-Reply-To: <87wqqywawa.fsf@gmail.com> (Albert Z. Wang's message of "Thu, 16 May 2013 23:19:49 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Albert Z. Wang" Cc: emacs-orgmode@gnu.org Hello, Thanks for your patch. > An alternative would be to stick this into ox-latex.el, which then > wouldn't interfere with other backends. > > I also think this functionality is good to have, since longer latex > documents often have unnumbered sections (and there seem to be > periodic questions on various boards on how to achieve this). While > one can mess around with the latex code, it's often a hassle when the > "master" document is in org and you need to recompile often. > > For a recent project I needed a super-simple way to turn off numbering > (for intro and references), so based on the above I made the following > tiny modification to ox-latex.el, which looks up the "LATEX_NUMBERED" > property to decide whether to insert a numbered or unnumbered heading. > Since I didn't need it, inheritance isn't in here, but it should be > simple enough to add. > > Since this wouldn't interfere with any other backends, perhaps there > will be fewer reservations about merging something like this into the > repo? If it has to be implemented, I think that's the most reasonable solution for now. For other back-ends, manual numbering specifications are just too vague to lead to useful code. > -- > diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el > index 41cf1d0..33a39c7 100644 > --- a/lisp/ox-latex.el > +++ b/lisp/ox-latex.el > @@ -1369,7 +1369,11 @@ holding contextual information." > (unless (org-element-property :footnote-section-p headline) > (let* ((class (plist-get info :latex-class)) > (level (org-export-get-relative-level headline info)) > - (numberedp (org-export-numbered-headline-p headline info)) > + (latex-numbered (org-export-get-node-property :LATEX_NUMBERED headline)) > + (numberedp > + (cond ((equal latex-numbered "n") nil) > + ((equal latex-numbered "y") t) > + (t (org-export-numbered-headline-p headline info)))) I'd rather have "nil", anything but "nil" and property not set. It also needs proper documentation in org.texi. Regards, -- Nicolas Goaziou