summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty')
-rw-r--r--Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty76
1 files changed, 76 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty b/Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty
new file mode 100644
index 00000000000..44dc6545e93
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/latex-tipps-und-tricks/lstfloat.sty
@@ -0,0 +1,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}}