%%
%% This is file `trivfloat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% trivfloat.dtx  (with options: `package')
%% trivfloat --- Quick floats in LaTeX
%% E-mail: joseph.wright@morningstar2.co.uk
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{trivfloat}
  [2009/04/23 v1.4 Quick floats in LaTeX]
\newif\iftfl@floatrow
\newcommand*{\tfl@make@execute}{}
\newcommand*{\tfl@make@pkg}{}
\DeclareOption{floatrow}{\tfl@floatrowtrue}
\DeclareOption{floatrow=true}{\tfl@floatrowtrue}
\DeclareOption{floatrow=false}{\tfl@floatrowfalse}
\DeclareOption*{%
  \expandafterAtEndOfPackage\expandafter{%
    \expandafter\trivfloat\expandafter{\CurrentOption}%
  }%
}
\ProcessOptions\relax
\@ifpackageloaded{floatrow}{%
  \renewcommand*{\tfl@make@pkg}{floatrow}
  \renewcommand*{\tfl@make@execute}{\@firstofone}
}{%
  \@ifpackageloaded{float}{%
    \renewcommand*{\tfl@make@pkg}{float}
    \renewcommand*{\tfl@make@execute}{\AtBeginDocument}
  }{%
    \@ifclassloaded{memoir}{%
      \renewcommand*{\tfl@make@pkg}{memoir}
      \renewcommand*{\tfl@make@execute}{\AtBeginDocument}
    }{%
      \iftfl@floatrow
        \RequirePackage{floatrow}
        \renewcommand*{\tfl@make@pkg}{floatrow}
        \renewcommand*{\tfl@make@execute}{\@firstofone}
      \else
        \RequirePackage{float}
        \renewcommand*{\tfl@make@pkg}{float}
        \renewcommand*{\tfl@make@execute}{\AtBeginDocument}
      \fi
    }%
  }%
}
\newcounter{tfl@float@cnt}
\newcommand*{\tfl@floatname}{}
\newcommand*{\tfl@chapter@hook}{}
\newcommand*{\tfl@chapter}{}
\ifx\@chapter\@undefined\else
  \let\tfl@chapter\@chapter
  \renewcommand*{\@chapter}{%
    \tfl@chapter@hook
    \tfl@chapter
  }
\fi
\newcommand*{\tfl@chapter@fix}[2]{%
  \g@addto@macro{\tfl@chapter@hook}{%
    \addtocontents{#2}{\protect\addvspace{10\p@}}%
  }%
  \@ifundefined{KOMAScriptVersion}{%
    \@namedef{the#1}{%
      \ifnum\c@chapter>\z@\relax
        \thechapter.%
      \fi
      \arabic{#1}%
    }%
  }{}%
}
\newcommand*{\tfl@generate@ext}{%
  \edef\tfl@ext{%
    \ifcase\value{tfl@float@cnt}% 0 not possible
    \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
  }%
}%
\newcommand*{\tfl@make@float}[2]{%
  \@ifundefined{chapter}{%
    \newfloat{#1}{tbp}{#2}%
  }{%
    \newfloat{#1}{tbp}{#2}[chapter]%
    \tfl@chapter@fix{#1}{#2}%
  }%
  \floatname{#1}{\@nameuse{#1name}}%
  \@namedef{listof#1s}{%
    \listof{#1}{\@nameuse{list#1name}}%
  }%
}
\newcommand*{\tfl@make@floatrow}[2]{%
  \@ifundefined{chapter}{%
    \DeclareNewFloatType{#1}{%
      fileext   = #2,
      placement = tbp,
      name      = {%
        \tfl@bgroup
        \tfl@name@format
        \tfl@upperfirst#1%
        \tfl@egroup
      }
    }%
  }{%
    \DeclareNewFloatType{#1}{%
      fileext   = #2,
      placement = tbp,
      name      = {%
        \tfl@bgroup
        \tfl@name@format
        \tfl@upperfirst#1%
        \tfl@egroup
      },
      within    = chapter
    }%
    \tfl@chapter@fix{#1}{#2}%
  }%
  \@namedef{listof#1s}{%
    \listof{#1}{\@nameuse{list#1name}}%
  }%
}
\newcommand*{\tfl@make@memoir}[2]{%
  \newfloat[chapter]{#1}{#2}{\@nameuse{#1name}}%
  \newlistof{listof#1s}{#2}{\@nameuse{list#1name}}%
  \addtodef{\@smemfront}{}{\counterwithout{#1}{chapter}}%
  \addtodef{\@smemmain}{}{%
    \ifartopt\else
      \counterwithin{#1}{chapter}%
    \fi
  }%
  \addtodef{\backmatter}{}{%
    \ifartopt\else
      \counterwithout{#1}{chapter}%
      \setcounter{#1}{0}%
    \fi
  }%
  \newlistentry[chapter]{#1}{#2}{0}%
  \cftsetindents{#1}{0em}{2.3em}%
  \addtodef{\insertchapterspace}{}{%
    \addtocontents{#2}{\protect\addvspace{10pt}}%
  }%
  \ifartopt
    \counterwithout{#1}{chapter}%
  \fi
}
\newcommand*{\tfl@make@names}{%
  \expandafter\edef\csname\tfl@floatname name\endcsname{%
    \noexpand\tfl@bgroup
    \noexpand\tfl@name@format
    \noexpand\tfl@upperfirst\tfl@floatname
    \noexpand\tfl@egroup
  }%
  \expandafter\edef\csname list\tfl@floatname name\endcsname{%
    List of \noexpand\tfl@upperfirst\tfl@floatname s
  }%
}
\newcommand*{\tfl@trivfloat}{%
  \stepcounter{tfl@float@cnt}%
  \tfl@generate@ext
  \tfl@make@names
  \begingroup
  \edef\@tempa{%
    \endgroup
    \expandafter\noexpand\tfl@make@execute{%
    \expandafter\noexpand\csname tfl@make@\tfl@make@pkg\endcsname
      {\tfl@floatname}{\tfl@ext}%
    }%
  }%
  \@tempa
}
\newcommand*{\tfl@uppercase}{}
\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\tfl@uppercase@aux{\uppercase{#1}}%
  \expandafter}%
  \tfl@uppercase@aux
}
\newcommand*{\tfl@uppercase@aux}{}
\newcommand*{\tfl@upperfirst}[1]{%
  \protect\@gobble\noexpand\tfl@uppercase#1%
}
\newcommand*{\trivfloat}[1]{%
  \@for\tfl@floatname:=#1\do{%
    \tfl@trivfloat
  }%
}
\@onlypreamble\trivfloat
\newcommand*{\tfl@bgroup}{}
\let\tfl@bgroup\relax
\newcommand*{\tfl@egroup}{}
\let\tfl@egroup\relax
\newcommand*{\tfl@name@format}{}
\let\tfl@name@format\relax
\AtBeginDocument{%
\@ifpackageloaded{babel}{%
  \iflanguage{french}{%
    \let\floatc@plain\FB@makecaption
    \let\tfl@bgroup\bgroup
    \let\tfl@egroup\egroup
    \let\tfl@name@format\scshape
  }{}%
}{}%
}%
%% 
%% Copyright (C) 2007,2009 by
%%   Joseph Wright <joseph.wright@morningstar2.co.uk>
%% 
%% It may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License (LPPL), either version 1.3c of
%% this license or (at your option) any later version.  The latest
%% version of this license is in the file:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Joseph Wright.
%% 
%% This work consists of the file  trivfloat.dtx
%%           and the derived files trivfloat.pdf,
%%                                 trivfloat.ins and
%%                                 trivfloat.sty.
%% 
%%
%% End of file `trivfloat.sty'.
