Professional Documents
Culture Documents
The well-known LATEX command \verb typesets code snippets verbatim. The new command
\lstinline pretty-prints the code, for example.
var i : integer ;
\lstinline!var i:integer;!
Display code
The lstlisting environment typesets the enclosed source code.
f o r i := maxint t o 0 do
begin
{do n o t h i n g }
end ;
Write ( C a s e i n s e n s i t i v e ) ;
WritE ( P a s c a l keywords .
) ;
The environment provides an optional argument. It tells the package to peform special tasks,
for example, to print only the lines 2-5:
begin
{do n o t h i n g }
end ;
C a s e insensitive
P a s c a l keywords .
);
);
Seduce to use
Line numbers are available for all displayed listings, e.g. tiny numbers on the left, each second line,
with 5pt distance to the listing:
1
f o r i := maxint t o 0 do
begin
{ do n o t h i n g }
end ;
Write (
WritE (
C a s e insensitive
P a s c a l keywords .
);
);
Floating listings
Displayed listings may float:
Listing 1: A floating example
1
f o r i := maxint t o 0 do
begin
{ do n o t h i n g }
end ;
Write (
WritE (
C a s e insensitive
P a s c a l keywords .
);
);