Pierre-Luc Gauthier <p.luc.gauth...@gmail.com> writes: > So my question is, > How can I export this tag filtered agenda view to, say a pdf with > LaTeX customizations and all that nice stuff. > The goal would be to be able to leave the house with a beautifully > typeset document containing all @Errands tagged headers *and* content? > > If I use org-agenda-write and write a PDF file, I get basically the > same screen as my view, no content, just the headers and in a rather > crude layout. > > I guess what I need (conceptually) is a way to get all headers having > said tag (or being a child of) be compiled in a file. Then I know all > the cool export stuff (e.g.: HTML, LaTeX, etc) will be accessible. >
The function org-map-entries could help here. For instance... --8<---------------cut here---------------start------------->8--- (org-map-entries '(concat (org-get-heading) "\n" (org-get-entry)) "@Errands" 'agenda)) --8<---------------cut here---------------end--------------->8--- ...will return a list of strings containing the heading and entry text for all of your entries tagged "@Errands". Then you could iterate through that list and insert each item as a top level heading in a new org file. The following, for instance, will extract all relevant headings and insert them in a temporary buffer ("/tmp/export.org"): --8<---------------cut here---------------start------------->8--- (with-current-buffer (find-file-noselect "/tmp/export.org") (delete-region (point-min) (point-max)) (insert "* ") (insert (mapconcat 'identity (org-map-entries '(concat (org-get-heading) "\n" (org-get-entry)) "@Errands" 'agenda) "\n* ")) (org-align-all-tags)) --8<---------------cut here---------------end--------------->8--- This could be further refined. E.g., you could extract specific heading components with the function org-heading-components and then place them directly in a LaTeX file. Best, Matt