%%----------------------------------------------------------------------
%% listing.sty
%
% LaTeX package. Documentation at end of file after \endinput.
%
% Requires LaTeX2e (or newer).
%
%
% (C) Copyright 1994 by:
%
% Matthew Hebley, Volker Kuhlmann
% University of Canterbury
% EEE Dept
% Christchurch, New Zealand
% E-Mail: HEBLEYMG@ELEC.CANTERBURY.AC.NZ, VOLKER@ELEC.CANTERBURY.AC.NZ
%
% Permission granted to use this file free of charge, and to distribute
% it provided no charge is made for distribution.
% This file must not be altered without changing its name.
%
%
% HISTORY:
%
% V1.0   19 Aug 94   Created.
%
%%----------------------------------------------------------------------

\def\filename{listing}
\def\fileversion{V1.0}
\def\filedate{1994/08/19}


\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}}
   
\DeclareOption{bigcaptions}{%
   \def\@bigcaptionflag{}
}

\ProcessOptions

 
\endinput


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

\usepackage[bigcaptions]{listing}


Package option:

bigcaptions          If present, captions appear as for sections
                     (or chapters when using the "book" class).
                     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]

