From 049f485bdf6f9dbd4880051384aaf239d85ba83e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Aug 2007 18:34:07 +0000 Subject: trvfloat 1.3 (21aug07) git-svn-id: svn://tug.org/texlive/trunk@4795 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/trivfloat/trivfloat.sty | 126 ++++++++++++++------- 1 file changed, 84 insertions(+), 42 deletions(-) (limited to 'Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty') diff --git a/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty b/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty index 014d2a2e6e7..ac665231c35 100644 --- a/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty +++ b/Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty @@ -14,16 +14,14 @@ %% ---------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{trivfloat} - [2007/08/13 v1.1 Quick floats in LaTeX] -\RequirePackage{float} + [2007/08/22 v1.3a Quick floats in LaTeX] +\@ifclassloaded{memoir} + {} + {\RequirePackage{float}} \newcount\tfl@floatcount% \def\tfl@genext{% - \expandafter\def\csname tfl@ext@\romannumeral\tfl@floatcount% - \expandafter\endcsname{% + \def\tfl@ext{% \ifcase\tfl@floatcount% - \PackageError{trivfloat}% - {Something's wrong here --- Contact the package author!}% - \@eha% \or % 1 loa% \or % 2 @@ -55,20 +53,18 @@ \or % 16 lor% \or % 17 - los% - \or % 18 lou% - \or % 19 + \or % 18 lov% - \or % 20 + \or % 19 low% - \or % 21 + \or % 20 lox% - \or % 22 + \or % 21 loy% - \or % 23 + \or % 22 loz% - \else % 24 or more + \else % 23 or more \PackageWarning{trivfloat}% {I've run out of extensions \MessageBreak% I'm using \jobname.xxx to list all future floats}% @@ -76,42 +72,88 @@ \fi% }% }% -\def\tfl@gennamea#1#2\end{% - \expandafter\def\csname tfl@name@\romannumeral\tfl@floatcount% - \expandafter\endcsname{% - \MakeUppercase{#1}% - \MakeLowercase{#2}% - }% -}% -\def\tfl@genname#1{% - \tfl@gennamea#1\end% -}% -\def\tfl@list#1#2#3{% - \newcommand*{#1}{\listof{#2}{#3}}% +\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]{% \advance\tfl@floatcount\@ne% \tfl@genext% - \tfl@genname{#1}% \PackageInfo{trivfloat}% - {Listing all floats of type #1 in \jobname.% - \csname tfl@ext@\romannumeral\tfl@floatcount\endcsname}% + {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% - \noexpand\newfloat{#1}{tbp}{% - \csname tfl@ext@\romannumeral\tfl@floatcount\endcsname% - }% - \noexpand\floatname{#1}{% - \expandafter\noexpand% - \csname tfl@name@\romannumeral\tfl@floatcount\endcsname% - }% - \noexpand\tfl@list{\csname listof#1s\endcsname}{#1}{% - List of \expandafter\noexpand% - \csname tfl@name@\romannumeral\tfl@floatcount\endcsname s% - }% + \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 -- cgit v1.2.3