From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frozenlock Subject: Including source when exporting in PDF Date: Wed, 4 Jan 2012 16:29:37 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiYOy-0005mg-9U for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 16:29:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RiYOx-0005Jo-4o for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 16:29:40 -0500 Received: from mail-tul01m020-f169.google.com ([209.85.214.169]:44075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiYOw-0005Jk-Uc for emacs-orgmode@gnu.org; Wed, 04 Jan 2012 16:29:39 -0500 Received: by obcwo8 with SMTP id wo8so17455026obc.0 for ; Wed, 04 Jan 2012 13:29:37 -0800 (PST) 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 I am a strong advocate in keeping the source of everything. However, a source can easily be lost if it doesn't follow the document. In LaTeX, there's a package to attach a file to a PDF (like when you attach a file to an email). By doing so, the source will follow the PDF even if the common reader have no clue what it's for, or even how to use it. Here is how I attach my org source to every document I export to PDF: --8<---------------cut here---------------start------------->8--- ;; Include the source file for every exported PDF (org-mode) (eval-after-load "org-exp" '(defadvice org-export-as-latex (around org-export-add-source-pdf activate) "Add the source (org file) to the resulting pdf file" (let ((filename (buffer-name))) ad-do-it ;do the function (let ((latex-buffer ad-return-value)) (set-buffer latex-buffer) (while (re-search-forward "\\\\usepackage{.+}" nil t)); go to the end of packages (insert "\n\\usepackage{attachfile2}"); the package needed to attach files (when (re-search-forward "\\\\end{document}" nil t) (forward-line -1) (insert (concat "\\vfill\n" "\\footnotesize\n" "The source of this document is an Org-Mode file attached here:" "\n\\attachfile" "{" filename "}"))) (save-buffer))))) --8<---------------cut here---------------end--------------->8--- This is by no mean a patch, but rather a quick hack. Perhaps someone with a working knowledge of the org-export could find a way to add a source option? Cheers!