diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-04-25 08:08:10 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-04-25 08:08:10 +0000 |
commit | e558366edbd26635399b395a9845aebf7bcfa479 (patch) | |
tree | 0fdab43fc7594efd8d379992a57a730b8d353bfd /Master/texmf-dist/tex | |
parent | 4efb9f5021d5bbb11a16ffe52de1c3cc5b05e1d9 (diff) |
trivfloat v1.4
git-svn-id: svn://tug.org/texlive/trunk@12818 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty | 314 |
1 files changed, 215 insertions, 99 deletions
diff --git a/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty b/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty index 730ce587fd1..4013f2a9fe9 100644 --- a/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty +++ b/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty @@ -5,23 +5,78 @@ %% 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 -%% ---------------------------------------------------------------- +%% 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} - [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% + [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 @@ -65,99 +120,160 @@ \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}% + \PackageWarning{trivfloat}{% + I've run out of extensions \MessageBreak + I'm using \jobname.xxx to list all future floats + }% xxx% - \fi% + \fi }% }% -\DeclareRobustCommand\tfl@uppercase[1]{% +\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\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{% + \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% } -\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} - } -}% + \@for\tfl@floatname:=#1\do{% + \tfl@trivfloat + }% +} \@onlypreamble\trivfloat -\DeclareOption*{\expandafter\trivfloat\expandafter{\CurrentOption}} -\ProcessOptions -\endinput +\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'. |