LaTeX command to create C file

Question:

Hi, I would like to know if there is a way to generate a file from the PDF created in LaTeX.

What I want to do: Write a LaTeX code, compile and generate its PDF. At some point, I want to show a code that is too long to fit inside the PDF (readability issue) and then I click on a name (For example: "Datahandling.c") and then a file "Datahandling.c" is created. in the same PDF folder for the person to open, view, compile, and test. Clicking on the name is similar to that given by references, which opens an external link (url) or goes to a certain part of the PDF.

This prevents the PDF from getting polluted with too much code (3 pages in a row) and sending .rar or .zip files with the PDF and various codes inside.

If it is not possible to create a file, how can I open it by clicking on the name, in case I send a zip with PDF and codes inside?

Answer:

Use: \usepackage[pdftex]{hyperref}

So: \href{filename.c}{texto do link} in the body of the text.

Search on Latex Hyperref for more information.


In this case, you must distribute the file along with the PDF. Latex won't create it, just create the link for the person to click.

Scroll to Top