I have an org document that has confidential and non-confidential information. I need to publish the org file to two different pdfs: one that contains all of the information from the org file and the other with the non-confidential information.

I have tried the following elisp.

(setq org-publish-project-alist
    '(("counselor"   :base-directory "~/Dropbox/org/"   
    :base-extension "org"    
    :publishing-directory "~/Dropbox/org/"   
    :exclude-tags "confidential"
    :recursive t
    :title "Appointments"
    :publishing-function org-latex-publish-to-pdf
    :headline-levels 4
    :exclude ".*"   
    :include ["appointments.org"]))

This produces an appointments.pdf document, but the confidential tags are still included. I also don't know how to change the file name to be appointments-confidential.pdf and appointments-non-confidential.pdf.


The solution I found was to write my own publishing function. The function is a wrapper around the org-latex-publish-to-pdf that also calls rename-file.

(defun publish-function-counselor-appointments (PLIST FILENAME PUB-DIR)
  (org-latex-publish-to-pdf PLIST FILENAME PUB-DIR)
  (rename-file "~/appointments.pdf" "~/counselor_appointments.pdf"))

My org-publish-project-alist looks something like this:

'(("counselor appointments"
   :base-directory "~/"
   :base-extension "org"
   :publishing-directory "~/"
   :exclude-tags ("confidential" "noexport")
   :publishing-function publish-function-counselor-appointments
   :headline-levels 4
   :exclude ".*"
   :include ["appointments.org"]))

I can create another entry in the alist that will produce a different pdf file by supplying a different publishing function. Thus, one org file can be used to produce varying pdf files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.