From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: [new exporter] ignoring a headline on export to PDF via latex Date: Tue, 5 Mar 2013 20:58:28 +0000 (UTC) Message-ID: References: <87zjyh7vql.fsf@pinto.chemeng.ucl.ac.uk> <20130305153803.GL7544@kuru.dyndns-at-home.com> <87d2vd3hy5.fsf@ucl.ac.uk> <11722.1362507903@alphaville> <20130305191633.GN7544@kuru.dyndns-at-home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCywi-0001zH-8o for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 15:58:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCywf-0000Nx-Oe for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 15:58:48 -0500 Received: from plane.gmane.org ([80.91.229.3]:58392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCywf-0000Nr-IA for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 15:58:45 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UCywz-000713-C1 for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 21:59:05 +0100 Received: from 137.110.34.176 ([137.110.34.176]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Mar 2013 21:59:05 +0100 Received: from ccberry by 137.110.34.176 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Mar 2013 21:59:05 +0100 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: emacs-orgmode@gnu.org Suvayu Ali gmail.com> writes: > > On Tue, Mar 05, 2013 at 01:25:03PM -0500, Nick Dokos wrote: > > Eric S Fraga ucl.ac.uk> wrote: > > > > > Suvayu Ali gmail.com> writes: > > > > > > [...] > > > > > > > Try using your function with a filter. This filter might work: > > > > org-export-filter-headline-functions. Of course it goes without saying > > > > you will have to update your function. > > > > > > Thanks Suvayu. It is this update that I need help with! The > > > documentation of that variable is close to impenetrable to me (e.g. what > > > is a /communication channel/?). > > > > > > > Reading the commentary in ox.el might help, at least to shed light on > > some terminology. > > As far as know, it is a property list returned by the parser. Look in > lisp/ox.el:1094. Beyond that my understanding is also a bit hazy. I > think I have gone through that bit of the comments at least once, but it > is a little difficult to follow for me (my lack of understanding of lisp > is probably to blame :-p). If you just want the latex to have "\section{}" you can do this #+BEGIN_SRC emacs-lisp (defun org-latex-ignore-heading-filter-headline (headline backend info) "Strip headline from HEADLINE. Ignore BACKEND and INFO." (replace-regexp-in-string "^[\\]section\\[.*\\textsc{ignoreheading}}$" "\\section{}" headline nil t)) #+END_SRC #+BEGIN_SRC emacs-lisp (require 'ox-latex) (org-export-define-derived-backend latex3 latex :filters-alist ( (:filter-headline . org-latex-ignore-heading-filter-headline))) #+END_SRC then (org-export-to-buffer 'latex3 "a-buffer-name") should do it. The so-called 'headline' is actually a lot more than I would have thought. If you use this filter instead: #+BEGIN_SRC emacs-lisp (defun filter-headline-show (text back-end info) (format "%s" text)) #+END_SRC you will see that the headline --- enclosed in .... <\hdln> will typically contain within it an entire "section" (in exporter `:filter-section' terms - not latex's \section{}) FWIW, I defun'ed filters like the above for all of the filter functions that can take (text backend info) as arguments. Then using a derived backend like the above `latex3', I can see where the filterable elements are. It is trivial to do, but if anyone is interested, I can post or upload somewhere. Chuck