Hacker News new | ask | show | jobs
by snksnk 1803 days ago
Why not use TeX/LaTeX instead and also include a link to the code?
1 comments

The LaTeX below will leave a push-pin symbol in the text, and clicking on it shows the code.

  \documentclass{article}
  \usepackage{attachfile}
  \usepackage{lipsum}
 
 \begin{document}\expandafter\attachfile\expandafter{\jobname.tex}
  \lipsum[1-150]
  \end{document}
Using xelatex, I got only the text, no pushbutton. Using pdflatex, I got a pushbutton, but it was not a hyperlink, just an image. What engine do you use to get this to work?
I ran pdflatex from a 2017 TeX Live install under Ubuntu, and viewed in Acrobat Reader.
Ahh, I think it is a viewer problem. Sadly, most viewers can not handle PDF attachments properly or at all.