Latex command to create C file

Asked

Viewed 46 times

3

Hello, I wonder if there is a way to generate a file from the PDF prepared in Latex.

What I want to do: I write Latex code, compile and I write his PDF. At some point, I want to show a code that is too long to stay inside the PDF (legibility issue) and then click on a name (for example: "Treatmentfingered.c") and then create a file "Treatmentfingered. c" 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 avoids PDF getting polluted with too much code (3 pages in a row) and sending . rar or . zip files with PDF and various codes inside.

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

  • Ever heard of Listing? Or algorithm2e?

  • I have heard of Listing through the link below. In case it is interesting for small codes. But I have not heard of algorithm2e, I will take a look. http://latexbr.blogspot.com.br/2012/07/dica-mostrando-codigo-c-java-etc-no.html

  • See if this listing on page 29 is big enough for you: https://www.dropbox.com/s/be4lg8p48rqrp2m/mono_final.pdf?dl=0 ; I think it’s the largest listing I’ve ever done in Latex

  • In this link, I used a customization of the algorithm2e, however I lost this custom file

1 answer

2


Use: \usepackage[pdftex]{hyperref}

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

Search Latex Hyperref for more information.


In this case, you must distribute the file together with the PDF. The latex will not create it, only create the link for the person clicking.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.