[texhax] including non .tex files in a LaTeX document

Aethon aethon at gmail.com
Sat Apr 1 22:22:37 CEST 2006


On 4/1/06, Peter Michaux <petermichaux at gmail.com> wrote:
> On 4/1/06, Bryan W. Lepore <bryanlepore at mail.utexas.edu> wrote:
> > On Sat, 1 Apr 2006, Peter Michaux wrote:
> > > I would like to include a file that has some programming code in my LaTeX
> > > document. the file extension is not "tex". Is this possible?
> >
> > \begin{verbatim}
> > copy+paste
> > \end{verbatim}
>
> Thanks but I don't want to copy and paste. The code is live and
> working and if I make changes then using include will enable the LaTeX
> document to be up to date with the code files.

Take a look at the listings pacakge.

>From a previous time I used the package:

\usepackage{listings}

\lstset{language=C++,basicstyle=\footnotesize}
\lstinputlisting[numbers=left,stepnumber=1,breaklines=true]{prob4/enumtheory.h}


Which as you can guess included enumtheory.h (which was in a subdir
called prob4) and formatted it for C++.


More information about the texhax mailing list