File: exlst.tex

package info (click to toggle)
hevea 2.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,824 kB
  • sloc: ml: 19,525; sh: 505; makefile: 311; ansic: 132
file content (124 lines) | stat: -rw-r--r-- 2,776 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
\documentclass{article}
\usepackage{listings}
\usepackage{color}
\let\underbar\underline
\begin{document}%
\lstset{language=Pascal}

En ligne~: \lstinline!var i:integer!.

\begin{lstlisting}
    for i:=maxint to 0 do
    begin
        { do nothing }
    end;

    Write('Case insensitive ');
    WritE('Pascal keywords.');
\end{lstlisting}

\begin{lstlisting}[firstline=2, lastline=5]
    for i:=maxint to 0 do
    begin
        { do nothing }
    end;

    Write('Case insensitive ');
    WritE('Pascal keywords.');
\end{lstlisting}

\lstinputlisting[lastline=4]{prog.p}

\begin{flushleft}%
\lstset{% general command to set parameter(s)
        basicstyle=\small,          % print whole listing small
        keywordstyle=\color{black}\bfseries\underbar,
                                    % underlined bold black keywords
        identifierstyle=,           % nothing happens
        commentstyle=\color{white}, % white comments
        stringstyle=\ttfamily,      % typewriter type for strings
        showstringspaces=false}     % no special string spaces
\begin{lstlisting}
    for i:=maxint to 0 do
    begin
        { do nothing }
    end;

    Write('Case insensitive ');
    WritE('Pascal keywords.');
\end{lstlisting}
\end{flushleft}

\begin{flushleft}%
\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
\begin{lstlisting}
    for i:=maxint to 0 do
    begin
        { do nothing }
    end;

    Write('Case insensitive ');
    WritE('Pascal keywords.');
\end{lstlisting}
\end{flushleft}

\begin{lstlisting}[float,caption=A floating example]
    for i:=maxint to 0 do
    begin
        { do nothing }
    end;

    Write('Case insensitive ');
    WritE('Pascal keywords.');
\end{lstlisting}

\section*{Special Characters}
\begin{lstlisting}[tabsize=2]
123456789
	{ one tabulator }
		{ two tabulators }
123		{ 123 + two tabs }
\end{lstlisting}


\begin{lstlisting}[showspaces=true, showtabs=true, tab=\rightarrowfill]
    for i:=maxint to 0 do
    begin
	{ do nothing }
    end;
\end{lstlisting}

\section*{Line numbers}
\begin{lstlisting}[firstnumber=100, numbers=left, stepnumber=2]
  for i := 0 to maxtint do
  begin
   { do nothing }
  end
\end{lstlisting}
And we continue the listing:
\begin{lstlisting}[firstnumber=last, numbers=left, stepnumber=2]
Write('Case insensitive') ;
WritE('Pascal keywords') ;
\end{lstlisting}

\begin{lstlisting}[name=Test, numbers=left]
  for i := 0 to maxtint do
  begin
   { do nothing }
  end
\end{lstlisting}
And we continue the listing:
\begin{lstlisting}[name=Test, numbers=left]
Write('Case insensitive') ;
WritE('Pascal keywords') ;
\end{lstlisting}

\section*{Layout elements}
\begin{lstlisting}[frame=single]
  for i := 0 to maxtint do
  begin
   { do nothing }
  end
\end{lstlisting}
\end{document}