LaTeX 'Attaching' Files to a Latex Document

  • Thread starter Thread starter thegreenlaser
  • Start date Start date
  • Tags Tags
    files Latex
AI Thread Summary
To ensure that source code is readily accessible in a final report without losing control over the files, several methods can be utilized. The attachfile package in LaTeX allows users to embed files directly into the PDF, enabling readers to click and access the source code without needing separate folders. This is particularly useful for maintaining file integrity after submission. Alternatively, hosting the source code online and including hyperlinks in the document is another effective strategy. While including the code in an appendix using the listings package is an option, it may not be visually appealing if the code is extensive. The primary goal is to facilitate easy access for readers to run the code rather than to study it in detail.
thegreenlaser
Messages
524
Reaction score
16
I'm writing a final report, and I've got a bunch of source code that I'd like to have readily available to anyone reading the document. I won't have any control over the files once I hand it in, so I'm a little wary about just putting everything in the same folder and trusting that everything will stay there. Is there any way that I can sort of 'attach' the source code to the Latex PDF so that if someone opens it up they can click a link and for sure be able to access these files, even if the only thing saved on the computer is that PDF?

Thanks.
 
Physics news on Phys.org
jhae2.718 said:
Maybe create an appendix and use the "listings" package to format the source code?

Edit: it looks like there's an attachfile package: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.169.9317&rep=rep1&type=pdf http://www.ctan.org/tex-archive/macros/latex/contrib/attachfile

Another method would be to host the source online and include a hyperlink.

That attachfile package looks about perfect, assuming I can get it to work. I was going to just put all the source code in an appendix like you suggested, but I think there's too much for it to look nice. My intention is more for someone to be able to access the code and run it rather than necessarily study it closely.
 
Last edited by a moderator:

Similar threads

Replies
12
Views
3K
Replies
4
Views
9K
Replies
7
Views
3K
Replies
1
Views
4K
Replies
2
Views
2K
Replies
2
Views
6K
Replies
5
Views
5K
Replies
1
Views
3K
Back
Top