"Fossies" - the Fresh Open Source Software Archive

Member "hevea-2.35/examples/exlst.tex" (16 Jan 2021, 2776 Bytes) of package /linux/www/hevea-2.35.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TeX and LaTeX source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 \documentclass{article}
    2 \usepackage{listings}
    3 \usepackage{color}
    4 \let\underbar\underline
    5 \begin{document}%
    6 \lstset{language=Pascal}
    7 
    8 En ligne~: \lstinline!var i:integer!.
    9 
   10 \begin{lstlisting}
   11     for i:=maxint to 0 do
   12     begin
   13         { do nothing }
   14     end;
   15 
   16     Write('Case insensitive ');
   17     WritE('Pascal keywords.');
   18 \end{lstlisting}
   19 
   20 \begin{lstlisting}[firstline=2, lastline=5]
   21     for i:=maxint to 0 do
   22     begin
   23         { do nothing }
   24     end;
   25 
   26     Write('Case insensitive ');
   27     WritE('Pascal keywords.');
   28 \end{lstlisting}
   29 
   30 \lstinputlisting[lastline=4]{prog.p}
   31 
   32 \begin{flushleft}%
   33 \lstset{% general command to set parameter(s)
   34         basicstyle=\small,          % print whole listing small
   35         keywordstyle=\color{black}\bfseries\underbar,
   36                                     % underlined bold black keywords
   37         identifierstyle=,           % nothing happens
   38         commentstyle=\color{white}, % white comments
   39         stringstyle=\ttfamily,      % typewriter type for strings
   40         showstringspaces=false}     % no special string spaces
   41 \begin{lstlisting}
   42     for i:=maxint to 0 do
   43     begin
   44         { do nothing }
   45     end;
   46 
   47     Write('Case insensitive ');
   48     WritE('Pascal keywords.');
   49 \end{lstlisting}
   50 \end{flushleft}
   51 
   52 \begin{flushleft}%
   53 \lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
   54 \begin{lstlisting}
   55     for i:=maxint to 0 do
   56     begin
   57         { do nothing }
   58     end;
   59 
   60     Write('Case insensitive ');
   61     WritE('Pascal keywords.');
   62 \end{lstlisting}
   63 \end{flushleft}
   64 
   65 \begin{lstlisting}[float,caption=A floating example]
   66     for i:=maxint to 0 do
   67     begin
   68         { do nothing }
   69     end;
   70 
   71     Write('Case insensitive ');
   72     WritE('Pascal keywords.');
   73 \end{lstlisting}
   74 
   75 \section*{Special Characters}
   76 \begin{lstlisting}[tabsize=2]
   77 123456789
   78     { one tabulator }
   79         { two tabulators }
   80 123     { 123 + two tabs }
   81 \end{lstlisting}
   82 
   83 
   84 \begin{lstlisting}[showspaces=true, showtabs=true, tab=\rightarrowfill]
   85     for i:=maxint to 0 do
   86     begin
   87     { do nothing }
   88     end;
   89 \end{lstlisting}
   90 
   91 \section*{Line numbers}
   92 \begin{lstlisting}[firstnumber=100, numbers=left, stepnumber=2]
   93   for i := 0 to maxtint do
   94   begin
   95    { do nothing }
   96   end
   97 \end{lstlisting}
   98 And we continue the listing:
   99 \begin{lstlisting}[firstnumber=last, numbers=left, stepnumber=2]
  100 Write('Case insensitive') ;
  101 WritE('Pascal keywords') ;
  102 \end{lstlisting}
  103 
  104 \begin{lstlisting}[name=Test, numbers=left]
  105   for i := 0 to maxtint do
  106   begin
  107    { do nothing }
  108   end
  109 \end{lstlisting}
  110 And we continue the listing:
  111 \begin{lstlisting}[name=Test, numbers=left]
  112 Write('Case insensitive') ;
  113 WritE('Pascal keywords') ;
  114 \end{lstlisting}
  115 
  116 \section*{Layout elements}
  117 \begin{lstlisting}[frame=single]
  118   for i := 0 to maxtint do
  119   begin
  120    { do nothing }
  121   end
  122 \end{lstlisting}
  123 \end{document}
  124