'Attaching' Files to a Latex Document

  • Context: LaTeX 
  • Thread starter Thread starter thegreenlaser
  • Start date Start date
  • Tags Tags
    files Latex
Click For Summary
SUMMARY

The discussion focuses on methods to attach source code files to a LaTeX document for easy access by readers. The "attachfile" package is identified as a primary solution, allowing users to embed files directly within the PDF. Additionally, hosting the source code online and including hyperlinks is suggested as an alternative. The "listings" package is recommended for formatting the source code in an appendix, although concerns about presentation are noted.

PREREQUISITES
  • Familiarity with LaTeX document preparation
  • Understanding of the "attachfile" package
  • Knowledge of the "listings" package for code formatting
  • Basic web hosting concepts for online file access
NEXT STEPS
  • Research the "attachfile" package for LaTeX and its implementation
  • Learn how to use the "listings" package for formatting source code in LaTeX
  • Explore options for hosting files online and creating hyperlinks in LaTeX
  • Investigate best practices for organizing appendices in LaTeX documents
USEFUL FOR

LaTeX users, technical writers, and researchers looking to enhance document accessibility by embedding or linking source code files within their PDFs.

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
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 ·
Replies
12
Views
4K
  • · Replies 7 ·
Replies
7
Views
15K
  • · Replies 4 ·
Replies
4
Views
9K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
7K
Replies
15
Views
11K
  • · Replies 5 ·
Replies
5
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K