Tuesday, 23 October 2007

Source code in LaTeX

If you want to include some source code into a LaTeX-document, you can of course use the verbatim environment. It can be useful to refer to an external file rather than copy & paste the source into the LaTeX-file.

To refer to an external file (which has the advantage that you do not need to apply modifications in two places) can be done by using the moreverb package: insert
at the beginning of your document. I use the following macro

You can now use
in your document if you want to include the source text in the file ex5.m.

No comments: