Sourcecode listing in latex documents
 
They easiest way to display sourcecode in a latex document is to use "verbatim":
begin{verbatim}
sudo port -d sync
sudo port install cmake libtool jpeg tiff libpng
cd /usr/;mkdir src;cd src
end{verbatim}


A nicer way is the package "listings". Put the following in the header of the latex document:
\usepackage{listings}
Then to display sourcecode somewhere within your report:
lstset{language=bash, breaklines=true}
begin{lstlisting}[]
sudo port -d sync
sudo port install cmake libtool jpeg tiff libpng
cd /usr;mkdir src;cd src
end{lstlisting}


The options language=bash and breaklines=true are just 2 examples, much more options can be used.

Source:
- http://blog.robert-kummer.de/2006/04/latex-quellcode-listing.html
- http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
 
admin / Dec 05, 2010
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2019 / lookass.ch
makememad@lookass.ch