summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/listing/listing.sty
blob: 3592501e5b7d12b4fc26a56a87921d267674e15f (plain)
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
125
126
127
128
129
130
131
132
%%----------------------------------------------------------------------
%% listing.sty
%
% LaTeX package for typesetting listings. 
% Documentation at end of file after \endinput.
%
% Requires LaTeX2e (or newer).
%
%
% (C) Copyright 1994, 1996, 1999 by:
%
% Matthew Hebley, Volker Kuhlmann
% University of Canterbury
% EEE Dept
% Christchurch, New Zealand
% E-Mail: v.kuhlmann@elec.canterbury.ac.nz
%         (Matthew is no longer available for contact, email or otherwise)
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License, distributed from CTAN
% archives as macros/latex/base/lppl.txt; either
% version 1 of the License, or (at your option) any later version.
%
%
% HISTORY:
%
% 1.2   25 May 1999	Re-published under the LPPL. No other change.
% 1.1   07 Feb 96	Added setting of \thelisting with the book and
%			report document classes.
% 1.0   19 Aug 94	Created.
%
%%----------------------------------------------------------------------

\def\filename{listing}
\def\fileversion{V1.2}
\def\filedate{1999/05/25}


\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{\filename}[\filedate]
\typeout{Package `\filename', \fileversion, <\filedate>}


\newcounter{listing}
\setcounter{listing}{0}

\newenvironment{listing}{%
   \newcommand{\@captype}{listing}%
   \@ifundefined{@bigcaptionflag}{}{%
      \def\@makecaption##1##2{%
         \vskip \abovecaptionskip 
         \@listingsection*{##1:~##2}% 
         \vskip \belowcaptionskip 
         }
      }
   }%
   {}

\newcommand{\listingname}{Listing}
\newcommand{\listlistingname}{List of Listings}

\newcommand{\ext@listing}{lol}
\newcommand{\fnum@listing}{\listingname ~\thelisting }
\newcommand{\l@listing}{\@dottedtocline {1}{1.5em}{2.3em}}
\newcommand{\listoflistings}{%
   \@listingsection*{\listlistingname 
      \@mkboth{\uppercase{\listlistingname}}%
         {\uppercase{\listlistingname}}}%
   \@starttoc {lol}%
   }
\@ifundefined{chapter}{%
   \newcommand\@listingsection{\section}%
   }{%
   \newcommand\@listingsection{\chapter}%
   \renewcommand\thelisting{\thechapter.\arabic{listing}}%
   }
   
\DeclareOption{bigcaptions}{%
   \def\@bigcaptionflag{}
}

\ProcessOptions

 
\endinput


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Load with:

	\usepackage{listing}
or
	\usepackage[bigcaptions]{listing}


Package option:

bigcaptions	If present, captions appear as for sections
		(or chapters when using the "book" or "report" 
		classes).
		If not present, captions appear as for captions
		in the figure or table environment.


Available control sequences:

\begin{listing}		A new environment for listings is provided.
			Unlike figure and table, listing is NOT
			a floating environment.

\caption		As usual. (only inside listing!)
\label			As usual. (only inside listing; after \caption!)
\ref			As usual.
\listoflistings		As for \listoftables, \listoffigures.
\listingname		Produces the "Listing" text for the caption.
\listlistingname	Produces the "List of Listings" text.


A *.lol file is produced similar to *.lot, *.lof files.

Does not change \@makecaption (unless option "bigcaptions" is used),
so packages that change the layout of \caption still work.
listing.sty works together with hangcaption.sty.

	``Documentation is like sex.
	  If it is good, it is REALLY good, 
	  and if it is bad, it is better than nothing!''

						[Gabe Helou]

%% EOF listing.sty
%%----------------------------------------------------------------------