> As a part of my dissertation I need to include java library (it is rather > large library). is there an easy way to include Java code in LaTeX?
I use the listings, and fancyvrb packages:
\usepackage{fancyvrb} \usepackage{listings}
\lstset{language=Java,basicstyle=\footnotesize,fancyvrb=true} \begin{figure}[htbp] \centering
\begin{Verbatim}[frame=single,baselinestretch=1,fontsize=\footnotesize,numbers=left] public void newImage(Object source , ImageData image) { //.. snipped code } \end{Verbatim} \end{figure}
> > I use the listings, and fancyvrb packages: > > [...]
Thank you, it works.
> - Have you tried to use \verbatiminput to include the file by latex > instead of include it yourself, with the fancyvrb & listings package?
I am using it like this (note: \verbatiminput doesn't take additional info) :
\lstset{language=Java, basicstyle=\footnotesize, fancyvrb=true,breaklines} \VerbatimInput[baselinestretch=1,fontsize=\footnotesize,numbers=left]{file.java}
> - Is that the 'program' package will do a better job than listing?
You need to reformat your code first, but after that you may get better result.