From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [new exporter] ignoring a headline on export to PDF via latex Date: Tue, 05 Mar 2013 23:41:23 +0100 Message-ID: <87r4jtsc4s.fsf@gmail.com> References: <87zjyh7vql.fsf@pinto.chemeng.ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD0YE-0006W3-06 for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 17:41:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UD0YC-0007AD-N8 for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 17:41:37 -0500 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:40532) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UD0YC-0007A0-GW for emacs-orgmode@gnu.org; Tue, 05 Mar 2013 17:41:36 -0500 Received: by mail-wi0-f176.google.com with SMTP id hm14so155203wib.3 for ; Tue, 05 Mar 2013 14:41:35 -0800 (PST) In-Reply-To: <87zjyh7vql.fsf@pinto.chemeng.ucl.ac.uk> (Eric S. Fraga's message of "Tue, 5 Mar 2013 14:43:30 +0000") 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 Hello, Eric S Fraga writes: > I used to use the following to ignore a headline when exporting to PDF: > > #+begin_src emacs-lisp > (defun my-e-latex-headline (headline contents info) > (if (member "ignoreheading" (org-element-property :tags headline)) contents > (org-latex-headline headline contents info))) > (add-to-list 'org-latex-translate-alist '(headline . my-e-latex-headline)) > #+end_src > > With the new exporter, this no longer works. > > On the mailing list, I found this thread from a couple of months ago: > > http://comments.gmane.org/gmane.emacs.orgmode/62742 > > but I do not want to create a new backend just for this. Is there an > equivalent solution to the above with the new exporter? Nicolas, you do > imply that there is but you leave it as an exercise for the reader. As > much as I appreciate the pedagogical nature of your response, this > reader is not up to the task and a solution would be greatly > appreciated! Indeed, this won't work anymore: `org-latex-translate-alist' has been removed. The equivalent would just be to use a defadvice: #+begin_src emacs-lisp (defadvice org-latex-headline (around my-latex-skip-headlines (headline contents info) activate) (if (member "ignoreheading" (org-element-property :tags headline)) (setq ad-return-value contents) ad-do-it)) #+end_src Another approach is, as mentioned by Charles Berry, to remove the first line of transcoded headline when it contains "ignoreheading". #+begin_src emacs-lisp (defun org-latex-ignore-heading-filter-headline (headline backend info) "Strip headline from HEADLINE. Ignore BACKEND and INFO." (when (and (org-export-derived-backend-p backend 'latex) (string-match "\\`.*ignoreheading.*\n" headline)) (replace-match "" nil nil headline))) (add-to-list 'org-export-filter-headline-functions 'org-latex-ignore-heading-filter-headline) #+end_src Regards, -- Nicolas Goaziou