Re: [O] [new exporter] ignoring a headline on export to PDF?via?latex
Hi Charles, On Wed, Mar 06, 2013 at 07:11:48AM +, Charles Berry wrote: I added to org-hacks.org at the bottom of ** Exporting org files. I tried to push to worg but got a permission error - its been years since I last pushed anything, so something on my end probably needs to be updated. You probably your keys were not moved to the new machine that hosts Worg. An email to Bastien and/or Jason should fix that. I've posted the file at: https://raw.github.com/chasberry/orgmode-accessories/master/filter-markup.org If you would like to put it in org-hacks, I'd appreciate it. I had missed your email, I put your writeup with some minor formatting changes under the new exporters directory on Worg. Please have a look and let me know if they are in order. http://orgmode.org/worg/exporters/ http://orgmode.org/worg/exporters/filter-markup.html Here are the commits: http://orgmode.org/cgit.cgi/worg.git/commit/?id=0ae0f97db6ac6c3ca7cc94001a442e54c2d1d3d9 http://orgmode.org/cgit.cgi/worg.git/commit/?id=ce62735fd8298c8924f76098d768db42b53f155b Thanks a lot for your contribution. :) -- Suvayu Open source is the future. It sets us free.
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Nicolas Goaziou n.goaz...@gmail.com writes: [...] 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 Nicolas, this is exactly what I was looking for. It works perfectly. Many thanks! eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Charles Berry ccbe...@ucsd.edu writes: [...] If you just want the latex to have \section{} you can do this [...] Chuck, thanks for this. It makes sense and I will give it a try. This approach still does require creating a new backend. The implications of this are not clear to me but I will play with this to see. Thanks again, eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
[O] [new exporter] ignoring a headline on export to PDF via latex
Hello, 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! Thanks, eric -- Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
On Tue, Mar 05, 2013 at 02:43:30PM +, Eric S Fraga wrote: Hello, 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. 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. A very simple test tells me this is probably going to be backend specific. I have had this query about filters for a while now, how to write filters that are backend agnostic. I think I'll start a new thread once I have formulated my question more clearly. Hope this helps, -- Suvayu Open source is the future. It sets us free.
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Suvayu Ali fatkasuvayu+li...@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/?). I can manage without this feature for the moment so I'm not panicking but I do hope to find a solution eventually. Thanks again, eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Eric S Fraga e.fr...@ucl.ac.uk wrote: Suvayu Ali fatkasuvayu+li...@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. Nick I can manage without this feature for the moment so I'm not panicking but I do hope to find a solution eventually. Thanks again, eric -- : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D : in Emacs 24.3.50.1 and Org release_7.9.3f-1199-g3a0e55
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
On Tue, Mar 05, 2013 at 01:25:03PM -0500, Nick Dokos wrote: Eric S Fraga e.fr...@ucl.ac.uk wrote: Suvayu Ali fatkasuvayu+li...@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). Good Luck, -- Suvayu Open source is the future. It sets us free.
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Suvayu Ali fatkasuvayu+linux at gmail.com writes: On Tue, Mar 05, 2013 at 01:25:03PM -0500, Nick Dokos wrote: Eric S Fraga e.fraga at ucl.ac.uk wrote: Suvayu Ali fatkasuvayu+linux at 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 hdln%s/hdln text)) #+END_SRC you will see that the headline --- enclosed in hdln \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
Re: [O] [new exporter] ignoring a headline on export to PDF via?latex
On Tue, Mar 05, 2013 at 08:58:28PM +, Charles Berry wrote: [...] 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. That would be wonderful! You could put them up on Worg. This section on org-hacks would be appropriate: http://orgmode.org/worg/org-hacks.html#sec-1-10. If you do not have access to Worg, you can post the content in Org format on the list and I can add it. Cheers, -- Suvayu Open source is the future. It sets us free.
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Hello, Eric S Fraga e.fr...@ucl.ac.uk writes: Suvayu Ali fatkasuvayu+li...@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 A TYPE filter is called each time transcoding process is over of an element of type TYPE. Here, each time a headline is transcoded (along with its contents), functions in `org-export-filter-headline-functions' are called with the resulting string as the first argument (i.e. the LaTeX code for the headline and all its contents). There's a filter for each type of element/object, and a couple of special filters. (e.g. what is a /communication channel/?). The communication channel is basically a plist containing data available for all transcoding functions. 99% of its properties have constant values during export process (like export options, or pre-computed values from the parse tree). Nevertheless, it can be used to store some data at some point in time and retrieve it from another transcoding function later, effectively allowing communication between parts of the export system. Regards, -- Nicolas Goaziou
Re: [O] [new exporter] ignoring a headline on export to PDF via latex
Hello, Eric S Fraga e.fr...@ucl.ac.uk 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
Re: [O] [new exporter] ignoring a headline on export to PDF via?latex
Suvayu Ali fatkasuvayu+linux at gmail.com writes: On Tue, Mar 05, 2013 at 08:58:28PM +, Charles Berry wrote: [...] FWIW, I defun'ed filters like the above for all of the filter functions [...] if anyone is interested, I can post or upload somewhere. That would be wonderful! You could put them up on Worg. This section on org-hacks would be appropriate: http://orgmode.org/worg/org-hacks.html#sec-1-10. If you do not have access to Worg, you can post the content in Org format on the list and I can add it. I added to org-hacks.org at the bottom of ** Exporting org files. I tried to push to worg but got a permission error - its been years since I last pushed anything, so something on my end probably needs to be updated. I've posted the file at: https://raw.github.com/chasberry/orgmode-accessories/master/filter-markup.org If you would like to put it in org-hacks, I'd appreciate it.