From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Including source when exporting in PDF Date: Wed, 11 Jan 2012 16:28:44 +0100 Message-ID: <4F0DAAAC.50607@gmail.com> References: <8739bt1dhe.fsf@gmx.com> Reply-To: R.M.Krug@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl06g-0004YL-Ra for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:28:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rl06a-0002ig-L8 for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:28:54 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:45925) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl06a-0002iX-Dp for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:28:48 -0500 Received: by wgbdt13 with SMTP id dt13so730700wgb.30 for ; Wed, 11 Jan 2012 07:28:47 -0800 (PST) In-Reply-To: <8739bt1dhe.fsf@gmx.com> 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: Eric Schulte Cc: emacs-orgmode@gnu.org, Frozenlock -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/01/12 08:45, Eric Schulte wrote: > Frozenlock writes: > >> 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. >> > > This sounds like a great Reproducible Research practice. > >> >> Here is how I attach my org source to every document I export to >> PDF: >> >> ;; 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))))) >> >> >> 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? >> > > I think this practice may not actually require any changes to the > Org-mode core. The attached small Org-mode file will attach itself > to pdf exports using only features already present in Org-mode. Following this idea - how can I easily attach all files created by tangling? Is there a programmatic way, without having to specify them manually? Thanks, Rainer > > > > > > Thanks for sharing this idea! > >> >> >> Cheers! >> > - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk8NqqwACgkQoYgNqgF2egro/wCfTlVxaVNR1/5395UC8wWrL9Ku jhIAn3f3Lud1aFrHz1uzo7SlFH+CsmFi =wU4r -----END PGP SIGNATURE-----