I want to add all my Java source code to an appendix. But I have 20 projects. Is there a possibility to just tell LaTeX where the folder with the different projects are, and LaTeX collects all the source code from there? And gives each section and subsection the name of the file?
Wotcha. I've programmed a lot in Java lately and I want to include the different projects into my appendix.
I did write my java projects in Netbeans. The projects are structured as follows:
The purple folders (project XYZ) shall be the name of the section. The name of the subsection should be the name of the package (or the file, if there is no subsection) and the subsubsection shall be the name of the file.
I found an example on how to do it for the individual files. But I don't want to add all files individually for each project. I have like 20 projects with many packages and many files in them. It would take years.
So I wanted to ask: is there a way to just give the path to the folder with all projects in or to each individual projects and LaTeX collects all the files from there?
Here the example I talked about:
\documentclass{article}
\usepackage{pgffor}
\usepackage{listings}
\begin{document}
\foreach \java in {hello, hello} {
\begin{figure}[htpb]
\lstinputlisting[language=java]{\java.java}
\caption{Source code for \textsf{\java.java}}
\label{fig:\java}
\end{figure}
}
\end{document}