emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [new exporter] ignoring a headline on export to PDF via latex


From: Nicolas Goaziou
Subject: Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Date: Tue, 05 Mar 2013 23:41:23 +0100

Hello,

Eric S Fraga <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]