ID #1003

How to include source code (programs) in LaTeX?

How? Use {verbatim}...!
OR, you can use the package {algorithm/ic} for pseudo-code,
Note that algorithmic used with slide will sometimes cause problems due to the fact that floating environment is not preferred.
A simple solution is to change \begin{algorithm}[ht] to \begin{algorithm}[H].
(Thanks to Jinzan for bringing this up.)
OR, you can use the package {listings} (manual) for non-formatted text, which supports highlighting of common programming languages,
OR, a cumbersome but highly customizable way: highlight and alignment by using \hspace etc. :(

Tags: latex

Related entries:

You can comment this FAQ