summaryrefslogtreecommitdiff
path: root/info/examples/ltt/lstfloat.sty
blob: 4ee1b11b66e08ab798c79c3e7f0f7a1accc6ba85 (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
%  lstfloat.sty
%  Erzeugt gleitfaehige Verzeichnisse von Listings. 
%  Es wird das verbatim-Paket von RS, BR, CR geladen
%
%  \begin{source}
%   \caption{Legende\label{...}}
%   \addcomment{Etwas, das zusaetzlich ins 
%      Listingverzeichnis aufgenommen wird}
%   \begin{code}
%     verbatim-Text...
%   \end{code}
%  \end{source}
%
\RequirePackage{moreverb}
\RequirePackage{ifthen}

%  Die Listingumgebungen selbst
\newenvironment{source}
  {\@float{source}}
  {\end@float}
\newenvironment{source*}
  {\@dblfloat{source}}
  {\end@dblfloat}

%  Einige Hilfsfunktionen fuer Gleitobjekte
\newcommand{\fps@source}{htbp}
\newcommand{\ftype@source}{4}
\newcommand{\ext@source}{los}
\newcommand{\fnum@source}{\sourcename~\thesource}

%  Der Listingzaehler.
\newcommand{\sourcename}{Listing}
\@ifundefined{chapter}
 {\newcounter{source}
  \renewcommand{\thesource}{\arabic{source}}}
 {\newcounter{source}[chapter]
  \renewcommand{\thesource}
    {\thechapter-\arabic{source}}}

%  Formatiert die Eintraege im Listing-Verzeichnis.
\newcommand{\l@source}
 {\@dottedtocline{1}{1.5em}{2.3em}}

%  Erzeugt das Verzeichnis der Listings.
\newcommand{\losname}{Die Listings}
\newcommand{\tableofsources}
 {\setboolean{@restonecol}{false}
  \ifthenelse{\boolean{@twocolumn}}
    {\setboolean{@restonecol}{true}\onecolumn}
    {}
  % Verzeichnis erzeugen
  \chapter*{\losname\@mkboth{\losname}{\losname}}
  {\setlength{\parindent}{0pt}\@starttoc{los}}
  % Aenderungen rueckgaengig machen
  \ifthenelse{\boolean{@restonecol}}
    {\twocolumn}
    {}
 }

%  Setzt ein Listing verbatim, von Linien begrenzt. 
%  Ausser-/innerhalb der source-Umgebung anwendbar.
\newenvironment{code}
  {\rule{\linewidth}{0.5pt}\verbatimtab\relax}
  {\endverbatimtab\rule{\linewidth}{0.5pt}}

%  erzeugt die fuehrende oder abschliessende Linie. 
%  Geeignet fuer \listinginput von moreverb.
\newcommand{\coderule}{\rule{\linewidth}{0.5pt}}

%  Erlaubt die Aufnahme eines kleingeschriebenen 
%  Kommentars in das Listing-verzeichnis. 
%  Formatierung durch \bcom...\ecom
\newcommand{\addcomment}[1]
 {\addtocontents{los}{\protect\bcom{}#1\protect\ecom}}
\newcommand{\bcom}{\bgroup\footnotesize}
\newcommand{\ecom}{\egroup\par\vspace{1ex}}