%%
%% This is file `trivfloat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% trivfloat.dtx  (with options: `package')
%%  ----------------------------------------------------------------
%%  The trivfloat package - Quick floats in LaTeX
%%  Maintained by Joseph Wright
%%  E-mail: joseph.wright@morningstar2.co.uk
%%  Released under the LaTeX Project Public License v1.3 or later
%%  See http://www.latex-project.org/lppl.txt
%%  ----------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{trivfloat}
  [2007/09/20 v1.3b Quick floats in LaTeX]
\@ifclassloaded{memoir}
  {}
  {\RequirePackage{float}}
\newcount\tfl@floatcount%
\def\tfl@genext{%
  \def\tfl@ext{%
    \ifcase\tfl@floatcount%
    \or % 1
      loa%
    \or % 2
      lob%
    \or % 3
      loc%
    \or % 4
      lod%
    \or % 5
      loe%
    \or % 6
      loh%
    \or % 7
      loi%
    \or % 8
      loj%
    \or % 9
      lok%
    \or % 10
      lol%
    \or % 11
      lom%
    \or % 12
      lon%
    \or % 13
      loo%
    \or % 15
      loq%
    \or % 16
      lor%
    \or % 17
      lou%
    \or % 18
      lov%
    \or % 19
      low%
    \or % 20
      lox%
    \or % 21
      loy%
    \or % 22
      loz%
    \else % 23 or more
      \PackageWarning{trivfloat}%
        {I've run out of extensions \MessageBreak%
         I'm using \jobname.xxx to list all future floats}%
      xxx%
    \fi%
  }%
}%
\DeclareRobustCommand\tfl@uppercase[1]{%
  {%
    \def\i{I}\def\j{J}%
    \def\reserved@a##1##2{\let##1##2\reserved@a}%
    \expandafter\reserved@a\@uclclist\reserved@b{\reserved@b\@gobble}%
    \protected@edef\reserved@a{\uppercase{#1}}%
  \expandafter}\reserved@a
}%
\def\tfl@upperfirst#1{%
  \protect\@gobble\noexpand\tfl@uppercase#1%
}
\ifx\chapter\@undefined\else
  \def\tfl@chapter@hook{\relax}
  \let\tfl@orig@chapter\@chapter
  \def\tfl@chapter{\tfl@chapter@hook\tfl@orig@chapter}
  \let\@chapter\tfl@chapter
\fi
\newcommand*{\trivfloat}[1]{%
  \AtBeginDocument{%
    \advance\tfl@floatcount\@ne%
    \tfl@genext%
    \PackageInfo{trivfloat}%
      {Listing all ``#1'' floats in \jobname.\tfl@ext}%
    \expandafter\newcommand\expandafter*\expandafter%
      {\csname #1name\endcsname}
      {\noexpand\tfl@upperfirst#1}
    \expandafter\newcommand\expandafter*\expandafter%
      {\csname list#1name\endcsname}
        {List of \noexpand\tfl@upperfirst#1s}
    \begingroup%
    \edef\x{\endgroup%
      \@ifclassloaded{memoir}
        {\noexpand\newfloat[chapter]{#1}{\tfl@ext}
          {\csname #1name\endcsname}
        \noexpand\newlistof{listof#1s}{\tfl@ext}
          {\csname list#1name\endcsname}
        \noexpand\addtodef{\noexpand\insertchapterspace}{}%
          {\noexpand\addtocontents%
            {\tfl@ext}
            {\noexpand\protect\noexpand\addvspace{10pt}}}
        \noexpand\newlistentry[chapter]{#1}
          {\tfl@ext}{0}}
        {\ifx\chapter\@undefined
          \noexpand\newfloat{#1}{tbp}{\tfl@ext}
        \else
          \noexpand\newfloat{#1}{tbp}{\tfl@ext}[chapter]
        \fi
        \noexpand\floatname{#1}{\csname #1name\endcsname}%
        \noexpand\newcommand{\csname listof#1s\endcsname}%
          {\noexpand\listof{#1}{\csname list#1name\endcsname}}%
        \ifx\chapter\@undefined\else
          \noexpand\g@addto@macro{\noexpand\tfl@chapter@hook}
            {\noexpand\addtocontents%
              {\tfl@ext}
              {\noexpand\protect\noexpand\addvspace{10pt}}}
        \fi}
      }%
    \x%
    \@ifclassloaded{memoir}
      {\expandafter\renewcommand\expandafter{\csname the#1\endcsname}%
        {\thechapter.\expandafter\@arabic\csname c@#1\endcsname}
      \addtodef{\@smemfront}{}{\counterwithout{#1}{chapter}}
      \addtodef{\@smemmain}{}{%
        \ifartopt\else
          \counterwithin{#1}{chapter}
        \fi}
      \addtodef{\backmatter}{}{%
        \ifartopt\else
          \counterwithout{#1}{chapter}
          \setcounter{#1}{0}
        \fi}
      \ifartopt
        \counterwithout{#1}{chapter}
      \fi
      \cftsetindents{#1}{0em}{2.3em}}
    {\ifx\chapter\@undefined\else
      \ifx\KOMAScriptVersion\@undefined
        \expandafter\renewcommand\expandafter{\csname the#1\endcsname}%
          {\ifnum\c@chapter>\z@ \thechapter.\fi
            \expandafter\@arabic\csname c@#1\endcsname}
    \fi\fi}
  }
}%
\@onlypreamble\trivfloat
\DeclareOption*{\expandafter\trivfloat\expandafter{\CurrentOption}}
\ProcessOptions
\endinput
%%
%% End of file `trivfloat.sty'.
