General ⇒ Including source code file
Including source code file
I'm doing a report for a work at univ.
I want to include the source code of various code files, namely from Flex and Yacc, which generates large files.
So I used the command:
\VerbatimInput[fontsize=\footnotesize,numbers=left]{parserYacc2.y}
but the result is terrible, as the text from this file goes beyond the margins
here's a link to an example: Edit by localghost: No external links! Attachments go onto the forum server (see Board Rules).
how can i resolve this issue?
A friend told me to just copy & paste all the code inside the latex file under a
\begin{lstlisting}
...
\end{lstlisting}
environment that he gave me, but that is ridiculous imo...
Thx for your time!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Including source code file
you can use the \lstinputlisting to input stand alone files to your document; the listings package also offers automatic breaking of long lines. Refer to the package documentation for further details.
Re: Including source code file
Funny how I use that package for small snippets of code though the document, but didnt thought of using it for file including...