\documentclass[oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{lmodern}
\usepackage{geometry}
\geometry{verbose,a4paper}
\usepackage{babel}
\usepackage{listings}
\newcommand*\CMD[1]{{\ttfamily\textbackslash#1}}
\lstset{basicstyle=\ttfamily\small,language=TeX}
\usepackage[standard,noconfig]{ntheorem}
\usepackage{float}
\newfloat{Messages}{htb}{loM}[chapter]
\floatstyle{ruled}
\newfloat{myPics}{htb}{loP}[section]
\floatname{myPics}{Picture}

\begin{document}
\title{The package \texttt{float.sty}}
\author{Herbert Voß}
\date{5. November 2000}
\maketitle
\tableofcontents

\chapter{A New Type of Float}

With the \LaTeX{} float-packages you can define you own types of floats. This
document is written in bookstyle, which is important to show one of the options
of the float-package.

The first Message \ref{Message1} shows an easy definition of a new float with
the defaults. The caption can be written as \verb+\caption{...}+ and the label as
usual.

\begin{Messages} 
\centering
\fbox{%
\begin{minipage}{0.8\textwidth}
This is an example for a new float type Messages, which uses all the defaults
and a name for the type which can be used for the caption, too. Therefore the
definition is easy:

\CMD{usepackage\{float\}}\\
\CMD{newfloat\{Messages\}\{htb\}\{loM\}[chapter]}\\[1ex]
The arguments are: 
\begin{description}
\item[Messages] the name of the float. Important for the caption and the latex-syntax (see below) 
\item[htb] Placement, valid for all floats of type Messages 
\item[loM:] the name of the file which stores the captions for a list of Messages 
\item[chapter] numbering inside chapters, makes sense for the book-classes. 
\end{description}
\end{minipage}
}
\caption{my First Caption for my first Message float}\label{Message1}
\end{Messages}

The boxed float Message \ref{Message1} belongs to the latex-commands 

\begin{verbatim}
\begin{Messages} 
\centering
\fbox{\parbox{0.8\textwidth}{%
...
\end{verbatim}


which do not have anything to do with the new float-style. This is possible
with any type of float.


\section{Floatstyle}

The style of the floats may be changed with the \verb+floatstyle+
command and the options 

\begin{itemize}
\item plain
\item boxed
\item ruled
\end{itemize}
The \verb+\floatstyle+ command is a nice feature for the style
of a float. The new float myPics is defined as a ruled float and the \texttt{section}-option
for the caption-numbering. 

\begin{myPics} 
This is an example for float-type \texttt{myPics},
which was defind behind a \verb+\newfloat{ruled}+
- command. The name of the float for the caption was changed with the \verb+\floatname{}{}+
- command. This was all done in the latex preamble:
\begin{verbatim}
\floatstyle{ruled} \newfloat{myPics}{htb}{}[section]
\floatname{myPics}{Picture}
\end{verbatim}
\caption{my second Caption for my first Message float}
\end{myPics}


\section{FLoatplacement}\label{Placement}

Changing the predefined floatplacement of \textbf{any} float-type can be changed
with the \verb+\floatplacement+-command.

\floatplacement{Messages}{b}

Writing a \verb+\floatplacement{Messages}{b}+ \textbf{re}defines
the placement \textbf{b}ottom for the next messages-float. This Messages \ref{Message3}
appears in the text in the next line, but in the \LaTeX{}-output at the
end of this page!

\begin{Messages} 
\centering
\fbox{\parbox{0.8\textwidth}{%
Another messages-float, which is placed with the \CMD{floatplacement\{Messages\}\{b\}}
command at the bottom of this page
}}
\caption{my Caption for my second Message float}\label{Message2}
\end{Messages}

\textbf{But this gives some problems with the following floats!} Every following
float can't be placed before this float which is on the top of a page! The Picture
\ref{myPics2} is behind Messages \ref{Message3}, which makes no sense, because
there is enough place on this page to put \textbf{before} Picture \ref{myPics2}!


\section{Restyle floats}

With the \verb+\restylefloat+-command it is possible to change
the style of \textbf{any} float to another float-style. The commands
\begin{verbatim}
\floatstyle{boxed}
\restylefloat{myPics}
\end{verbatim}

\floatstyle{boxed}
\restylefloat{myPics}

The float Picture \ref{myPics2} which belongs to this section, is on the next
page in fact of the floating placement of Messages \ref{Message2} of Section
\ref{Placement}.

\begin{myPics} 
This is another example for float-type \texttt{myPics},
called Picture in the caption and defined with the \texttt{boxed}-option and
a placement \texttt{[htb]}.
\caption{my Caption for my second myPics float}\label{myPics2}
\end{myPics}


\section{The \texttt{H}-option}

With this option you can place your float as \textbf{ABOSLUTELY HERE} and mothing
elsewere!

\floatplacement{Messages}{H}
\begin{Messages} 
\centering
\fbox{\textbf{ABOSLUTELY HERE}}
\caption{my Caption for my third Message float}\label{Message3}
\end{Messages}

But this gives another error of the float-package: it can't handle the numbering,
because this Message \ref{Message3} is \textbf{before} Message \ref{Message2}!! 

Therefore you have to pay attention, when using the H-option.

\section{Standard figure- and table-floats}

Here comes a figure-float (Figure \ref{Figure1}) and a table-float (Table \ref{Table1}),
too. Both only for demonstration!




\begin{table}[htb]
\caption{my Table-Caption}\label{Table1}
\centering
\begin{tabular}{|c|c|c|}\hline 
a  &  b &  c\\\hline\hline 
10 & 11 & 12\\\hline 
\end{tabular}
\end{table}


\begin{figure}[htb]
\centering 
\fbox{here is no figure :-)}
\caption{my Figure Caption}\label{Figure1}
\end{figure}




\section{The \texttt{listof} command}

With the \verb+\listof{float}{title}+ -command you'll get
a list of your own floats. Here they come with the commands:
\begin{verbatim}
\listof{Messages}{List of the Messages}
\listof{myPics}{List of my Pics}
\end{verbatim}

Remeber, that we have the book-style, therefore listof belongs to the same like
listoffigures, which appearon own pages at the end of your document!

\listof{Messages}{List of the Messages}
\listof{myPics}{List of my Pics ;-)}
\listoffigures
\listoftables
\end{document}
