Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I generate data plots in my LaTeX documentation using a combination of TikZ and pgfplots. Many of the plots are generated using script files which can also include the raw data if data is being plotted. Is there anyway to embed the script files in the plot itself (these could be pgfplots scripts or python code etc)?

The idea is that if someone obtains the pdf file they can extract the script and/or data that actually generated the plot and therefore will be able to reproduce the figure themselves and have at hand the original data that was used.

I saw the message on pdfcomment and it looks very promising. Would pdfcomment be a good way to embed text in plots or are other other possible approaches?

A comment on those who might suggest why not just supply the raw LaTeX file. These documents get submitted to journals, archives (e.g. arXiv) and other repositories where the raw LaTeX file cannot usually be included with the submission.

share|improve this question
1  
Maybe you can embed your code as a pdf file something like this question how-do-i-make-an-attached-file-display-like-a-link? –  percusse Apr 9 '12 at 20:52
    
I don't understand the comment about the arXiv. If the LaTeX file was uploaded, anyone can access it. –  Loop Space Apr 9 '12 at 21:00
    
have you looked at these attach+file+to+pdf –  cmhughes Apr 9 '12 at 21:26
    
Rely to arXiv comment: arXiv doesn't give you access to the original LaTeX file only the finished pdf file. –  rhody Apr 9 '12 at 21:32
    
Reply to cmhughes, I hadn't come across attachfile.sty before, I think that's exactly what I want. Many thanks. –  rhody Apr 9 '12 at 21:36
show 4 more comments

1 Answer

There are a number of existing packages that can be used to attach data (in the form of files) to a pdf file generated from a LaTeX document. pdfcomment is a package that can be used to annotate a LaTeX file with user annotation and comments. The other possibility includes the packages attachfile and attachfile2. Files can be attached to specific points in the PDF file using these packages. Thus a graph can have the raw data attached to it. In the final pdf, attachments are indicated with icons and double clicking on the icon will bring up the appropriate external application to view the attached file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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