2

I want to include raw source code text that can be extracted from a PDF.

It looks like this might be possible using PDF layers or OCQ or some kind of accessible option but I can't find a TeX package. The source code does not have to be visible.

I have created my own "chunk" tags in latex that properly quotes blocks of code and I have a tool that will extract ("tangle") the code from the latex file. I want to extract the code from the PDF.

The goal is to be able to send someone a literate program PDF and give them a command line tool to extract the source code.

  • Though it doesn't fully answer your question, check out this post as a starting point. – Arun Debray Dec 26 '15 at 03:04
  • 1
    Welcome! Why don't you just send them the source code in addition or as an attachment to the PDF (i.e. an attached file)? If you are going to send them two things anyhow (PDF, tool), why not make it easy for them and send two other things (PDF, code)? What's the point of obfuscating the code by hiding it in the PDF? – cfr Dec 26 '15 at 03:22
  • @cfr The "code" is the whole latex file. Think of a physics textbook where you want to extract the equations by command line. It would look strange to have the appendix to the book include all of the latex to create the book. – Tim Daly Dec 26 '15 at 05:41

0 Answers0