'Attaching' Files to a Latex Document

  • Context: LaTeX 
  • Thread starter Thread starter thegreenlaser
  • Start date Start date
  • Tags Tags
    files Latex
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 4K views
thegreenlaser
Messages
524
Reaction score
17
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
Last edited by a moderator:
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: