How to "export" code?

I have a Java project and I need to make some code in my LaTeX documentation with all my classes and code. What is the best way to export code? Is it just simple to copy and paste, or is there a way to correctly export the code to preserve all the formatting?

+4
source share
4 answers

I found a way: http://texblog.wordpress.com/2008/04/02/include-source-code-in-latex-with-listings/

although, in this way, the code seems to launch the page.

+1
source

This is easy enough to do:

for d in `find <projectdir> -name '*.java'; do echo "$d" >> output.txt cat "$d" >> output.txt done 

... but what is the possible purpose of dumping all the code into a document?

+1
source

If LaTeX is the goal, I would look for some formatting patterns for the code. It's easy enough to get text in LaTeX, but the formatting will be different.

+1
source

You can also try the lists of packages that you mention directly in Eclipse with the TEXlipse plugin.

alt text
(source: sourceforge.net )

You can then see if you are linking to the right Java files in your links.
Used in this training slide 19 .


You can also try:

  • GNU source highlighting , which can produce latex output and may be more suitable for batch processing of all batches of files.
  • pygmentize , which needs Python and should also produce latex output.
+1
source

Source: https://habr.com/ru/post/1307667/


All Articles