20 test

download 20 test

of 2

Transcript of 20 test

  • 8/15/2019 20 test

    1/2

    Code snippets

    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 := ma xi nt t o 0 dob e g i n

    {do n o t h in g}end ;

    W ri te ( C a s e i n s e n s i t i v e ) ;WritE ( P a s c a l k ey wo rd s . ) ;

    The environment provides an optional argument. It tells the package to peform special tasks,for example, to print only the lines 2-5:

    b e g i n{do n o t h in g}

    end ;

    Stand alone files

    Finally we come to  \lstinputlisting  the command used to pretty-print stand alone files. I hasone optional and one file name argument.

    \lstinputlisting[lastline=4]{listings}

    /∗ p r i n t numbers f ro m 0 t o 1 0∗/

    f o r ( i n t i = 0; i

  • 8/15/2019 20 test

    2/2