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 | |
parent | 4efb9f5021d5bbb11a16ffe52de1c3cc5b05e1d9 (diff) |
trivfloat v1.4
git-svn-id: svn://tug.org/texlive/trunk@12818 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/trivfloat/README | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/trivfloat/trivfloat.pdf | bin | 126421 -> 144328 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/trivfloat/trivfloat.dtx | 1017 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/trivfloat/trivfloat.ins | 105 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/trivfloat/trivfloat.sty | 314 |
5 files changed, 929 insertions, 531 deletions
diff --git a/Master/texmf-dist/doc/latex/trivfloat/README b/Master/texmf-dist/doc/latex/trivfloat/README index 0d0c28bebc6..896d2e759e9 100644 --- a/Master/texmf-dist/doc/latex/trivfloat/README +++ b/Master/texmf-dist/doc/latex/trivfloat/README @@ -1,13 +1,11 @@ -The trivfloat package - Quick floats in LaTeX - ----------------------------------------------------------------- -Maintained by Joseph A. 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 ----------------------------------------------------------------- - -The trivfloat package provides a quick method for defining new -float types in LaTeX. A single command sets up a new float in -the same style as the LaTeX kernel figure and table float -types. +----------------------------------------------------------------
+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
+----------------------------------------------------------------
+
+The trivfloat package provides a quick method for defining new
+float types in LaTeX. A single command sets up a new float in
+the same style as the LaTeX kernel figure and table float
+types.
diff --git a/Master/texmf-dist/doc/latex/trivfloat/trivfloat.pdf b/Master/texmf-dist/doc/latex/trivfloat/trivfloat.pdf Binary files differindex 6ec6f579d04..30ab69885d0 100644 --- a/Master/texmf-dist/doc/latex/trivfloat/trivfloat.pdf +++ b/Master/texmf-dist/doc/latex/trivfloat/trivfloat.pdf diff --git a/Master/texmf-dist/source/latex/trivfloat/trivfloat.dtx b/Master/texmf-dist/source/latex/trivfloat/trivfloat.dtx index 33b68d767d5..d9fafc28546 100644 --- a/Master/texmf-dist/source/latex/trivfloat/trivfloat.dtx +++ b/Master/texmf-dist/source/latex/trivfloat/trivfloat.dtx @@ -1,283 +1,510 @@ % \iffalse meta-comment -% -% Copyright (C) 2007 by -% Joseph Wright <joseph.wright@morningstar2.co.uk> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either -% version 1.3 of this license or (at your option) any later -% version. The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of -% LaTeX version 2003/12/01 or later. -% -% This work has the LPPL maintenance status ``maintained.'' -% -% The current maintainer of this work is Joseph Wright. -% -% This work consists of the main source files trivfloat.dtx -% and trivfloat.ins and the derived files trivfloat.sty and -% trivfloat.pdf. -% +% !TEX program = pdflatex +% !TEX encoding = ISO-8859-1 +%<*internal> +\iffalse +%</internal> +%<*readme> +---------------------------------------------------------------- +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 +---------------------------------------------------------------- + +The trivfloat package provides a quick method for defining new +float types in LaTeX. A single command sets up a new float in +the same style as the LaTeX kernel figure and table float +types. +%</readme> +%<*internal> +\fi +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +%</internal> +%<*install> +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +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 +---------------------------------------------------------------- + +\endpreamble +\postamble + +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. + +\endpostamble +\usedir{tex/latex/trivfloat} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +%</install> +%<install>\endbatchfile +%<*internal> +\usedir{source/latex/trivfloat} +\generate{ + \file{\jobname.ins}{\from{\jobname.dtx}{install}} +} +\nopreamble\nopostamble +\usedir{doc/latex/trivfloat} +\generate{ + \file{README.txt}{\from{\jobname.dtx}{readme}} +} +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile +\else + \expandafter\endgroup +\fi +\immediate\write18{makeindex -s gglo.ist -o trivfloat.gls trivfloat.glo} +\immediate\write18{makeindex -s gind.ist -o trivfloat.ind trivfloat.idx} +%</internal> +%<*package> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{trivfloat} + [2009/04/23 v1.4 Quick floats in LaTeX] +%</package> %<*driver> -\PassOptionsToClass{a4paper}{article} -\documentclass{ltxdoc} -\EnableCrossrefs -\CodelineIndex -\RecordChanges -%\OnlyDescription +\documentclass[a4paper]{ltxdoc} \usepackage[T1]{fontenc} -\usepackage[english,UKenglish]{babel} -\usepackage{mathpazo,booktabs,array,url,graphicx,courier,unitsdef} -\usepackage{upgreek,ifpdf} +\usepackage{lmodern,trivfloat} +\usepackage[osf]{mathpazo} \usepackage[scaled=0.95]{helvet} -\usepackage[version=3]{mhchem} -\usepackage[final]{microtype} -% Some tricks from Heiko Oberdiek -\ifpdf - \usepackage{embedfile} - \embedfile[% - stringmethod=escape,% - mimetype=plain/text,% - desc={LaTeX docstrip source archive for package `\jobname'}% - ]{\jobname.dtx} -\fi -\usepackage{\jobname} +\usepackage[final]{listings,microtype} \usepackage[numbered]{hypdoc} +\trivfloat{graph} +\EnableCrossrefs +\CodelineIndex +\RecordChanges \begin{document} \DocInput{\jobname.dtx} \end{document} %</driver> % \fi % -% \CheckSum{240} -% -% \CharacterTable -% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z -% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z -% Digits \0\1\2\3\4\5\6\7\8\9 -% Exclamation \! Double quote \" Hash (number) \# -% Dollar \$ Percent \% Ampersand \& -% Acute accent \' Left paren \( Right paren \) -% Asterisk \* Plus \+ Comma \, -% Minus \- Point \. Solidus \/ -% Colon \: Semicolon \; Less than \< -% Equals \= Greater than \> Question mark \? -% Commercial at \@ Left bracket \[ Backslash \\ -% Right bracket \] Circumflex \^ Underscore \_ -% Grave accent \` Left brace \{ Vertical bar \| -% Right brace \} Tilde \~} -% -% \GetFileInfo{\jobname.sty} +%\CheckSum{295} % %\changes{v1.0}{2007/06/09}{Initial public release} %\changes{v1.1}{2007/08/13}{Floats can be generated as package % options} -%\changes{v1.2}{2007/08/20}{Added \texttt{memoir} support} +%\changes{v1.2}{2007/08/20}{Added \textsf{memoir} support} %\changes{v1.2}{2007/08/20}{Improved emulation of default floats} -%\changes{v1.3b}{2007/09/20}{Fixed error with \texttt{hyperref}} +%\changes{v1.3b}{2007/09/20}{Fixed error with \textsf{hyperref}} %\changes{v1.3b}{2007/09/20}{Licence changed from GPL to LPPL} -% -% \DoNotIndex{\@arabic,\@chapter,\@gobble,\@ifclassloaded,\@ne} -% \DoNotIndex{\@onlypreamble,\@smemfront,\@smemmain,\@uclclist} -% \DoNotIndex{\@undefined,\addtocontents,\addtodef,\addvspace} -% \DoNotIndex{\advance,\backmatter,\begingroup,\c@chapter} -% \DoNotIndex{\cftsetindents,\chapter,\counterwithin,\counterwithout} -% \DoNotIndex{\csname,\CurrentOption,\DeclareOption,\def,\edef,\else} -% \DoNotIndex{\endcsname,\endgroup,\expandafter,\fi,\floatname} -% \DoNotIndex{\g@addto@macro,\i,\ifartopt,\ifcase,\ifnum,\ifx} -% \DoNotIndex{\insertchapterspace,\j,\jobname,\KOMAScriptVersion} -% \DoNotIndex{\let,\listof,\MakeUppercase,\MessageBreak} -% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newfloat} -% \DoNotIndex{\newlistentry,\newlistof,\noexpand,\or,\PackageInfo} -% \DoNotIndex{\PackageWarning,\ProcessOptions,\protect} -% \DoNotIndex{\protected@edef,\ProvidesPackage,\relax,\renewcommand} -% \DoNotIndex{\RequirePackage,\reserved@a,\reserved@b,\setcounter} -% \DoNotIndex{\thechapter,\uppercase,\x,\z@,\DeclareRobustCommand} -% -% \title{Quick floats in LaTeX% -% \thanks{This file describes version \fileversion, last revised -% \filedate.}} -% \author{Joseph Wright% -% \thanks{E-mail: joseph.wright@morningstar2.co.uk}} -% \date{Released \filedate} +%\changes{v1.4}{2009/04/23}{Re-think of internal methods to make +% work-flow clearer} +%\changes{v1.4}{2009/04/23}{Support for \textsf{babel} introduced} +% +%\GetFileInfo{\jobname.sty} +% +%\makeatletter +% +%^^A \DescribeOption is in l3doc but not ltxdoc +%\newcommand*{\DescribeOption}{^^A +% \leavevmode +% \@bsphack +% \begingroup +% \MakePrivateLetters +% \Describe@Option +%} +%\newcommand*{\Describe@Option}[1]{^^A +% \endgroup +% \marginpar{^^A +% \raggedleft +% \PrintDescribeEnv{#1}^^A +% }% +% \SpecialOptionIndex{#1}^^A +% \@esphack +% \ignorespaces +%} +%\newcommand*{\SpecialOptionIndex}[1]{^^A +% \@bsphack +% \index{^^A +% #1\actualchar{\protect\ttfamily#1} (option)\encapchar usage^^A +% }^^A +% \index{^^A +% options:\levelchar#1\actualchar{\protect\ttfamily#1} +% \encapchar usage^^A +% }^^A +% \@esphack +%} +% +%^^A For creating examples with nice highlighting of code, and so +%^^A on; based on the system used in the listings source (lstsample). +%\lst@RequireAspects{writefile} +%\newsavebox{\LaTeXdemo@box} +%\lstnewenvironment{LaTeXdemo}[1][code and example]{^^A +% \global\let\lst@intname\@empty +% \expandafter\let\expandafter\LaTeXdemo@end +% \csname LaTeXdemo@#1@end\endcsname +% \@nameuse{LaTeXdemo@#1}^^A +%}{^^A +% \LaTeXdemo@end +%} +%\newcommand*\LaTeXdemo@new[3]{^^A +% \expandafter\newcommand\expandafter*\expandafter +% {\csname LaTeXdemo@#1\endcsname}{#2}^^A +% \expandafter\newcommand\expandafter*\expandafter +% {\csname LaTeXdemo@#1@end\endcsname}{#3}^^A +%} +%\newcommand*\LaTeXdemo@common{^^A +% \setkeys{lst}{ +% basicstyle = \small\ttfamily, +% basewidth = 0.51em, +% gobble = 3, +% keywordstyle = \color{blue}, +% language = [LaTeX]{TeX}, +% moretexcs = { +% trivfloat +% } +% }^^A +%} +%\newcommand*\LaTeXdemo@input{^^A +% \MakePercentComment +% \catcode`\^^M=10\relax +% \small +% \begingroup +% \setkeys{lst}{ +% SelectCharTable=\lst@ReplaceInput{\^\^I}{\lst@ProcessTabulator} +% }^^A +% \leavevmode +% \input{\jobname.tmp}^^A +% \endgroup +% \MakePercentIgnore +%} +%\LaTeXdemo@new{code and example}{^^A +% \setbox\LaTeXdemo@box=\hbox\bgroup +% \lst@BeginAlsoWriteFile{\jobname.tmp}^^A +% \LaTeXdemo@common +%}{^^A +% \lst@EndWriteFile +% \egroup +% \begin{center} +% \ifdim\wd\LaTeXdemo@box>0.48\linewidth\relax +% \hbox to\linewidth{\box\LaTeXdemo@box\hss}^^A +% \begin{minipage}{\linewidth} +% \LaTeXdemo@input +% \end{minipage} +% \else +% \begin{minipage}{0.48\linewidth} +% \LaTeXdemo@input +% \end{minipage} +% \hfill +% \begin{minipage}{0.48\linewidth} +% \hbox to\linewidth{\box\LaTeXdemo@box\hss}^^A +% \end{minipage} +% \fi +% \end{center} +%} +%\LaTeXdemo@new{code only}{^^A +% \LaTeXdemo@common +%}{} +% +%\LaTeXdemo@new{code and float}{^^A +% \lst@BeginAlsoWriteFile{\jobname.tmp}^^A +% \LaTeXdemo@common +%}{^^A +% \lst@EndWriteFile +% \LaTeXdemo@input +%} +% +%\providecommand*{\file}{\texttt} +%\providecommand*{\opt}{\texttt} +%\providecommand*{\pkg}{\textsf} +% +%\makeatother +% +%\title{^^A +% \textsf{trivfloat} --- Quick floats in +% \texorpdfstring{\LaTeX}{LaTeX}\thanks{^^A +% This file describes version \fileversion, last revised +% \filedate.^^A +% }^^A +%} +%\author{^^A +% Joseph Wright\thanks{E-mail: joseph.wright@morningstar2.co.uk}^^A +%} +%\date{Released \filedate} % %\maketitle % %\begin{abstract} -% The |trivfloat| package provides a quick method for defining new -% float types in LaTeX. A single command sets up a new float in the -% same style as the LaTeX kernel |figure| and |table| float types. +% The \pkg{trivfloat} package provides a quick method for defining new +% float types in \LaTeX. A single command sets up a new float in the +% same style as the \LaTeX\ kernel \texttt{figure} and \texttt{table} +% float types. %\end{abstract} % %\begin{multicols}{2} -%\tableofcontents +% \tableofcontents %\end{multicols} % %\section{Introduction} % -% The LaTeX kernel provides the |figure| and |table| floating -% environment, but does not provide an easy method for defining new -% float types. This problem is addressed by the |float| package, -% which provides an array of commands to create new float types. -% However, the one command missing is a quick one to set up a new -% float type with no customisation. This is addressed by the -% |trivfloat| package. -% -%\section{Usage} +% The LaTeX kernel provides the \texttt{figure} and \texttt{table} +% floating environment, but does not provide an easy method for +% defining new float types. This problem is addressed by the +% \pkg{float} and \pkg{floatrow} packages, which provides an array of +% commands to create new float types. However, the one command missing +% is a quick one to set up a new float type with no customisation. +% This is addressed by the \pkg{trivfloat} package. +% +%\section{Installation} +% +% The entire bundle is supplied with the TDS-ready ZIP file, +% \file{trivfloat.tds.zip}. Simply unzip this into your local texmf +% tree and run your hash program (\texttt{texhash} for \TeX{}Live or +% \texttt{initextmf -u} for MiK\TeX). +% +% To extract the package from \file{trivfloat.dtx}, run (pdf)\TeX\ on +% \file{trivfloat.dtx}. This will produce all of the package +% files, and also \file{README.txt}. To extract the +% files and build the documentation, run (pdf)\LaTeX\ on +% \texttt{trivfloat.dtx}. The files can then be installed as above. +% +%\section{Using the package} % %\DescribeMacro{\trivfloat} +%\changes{v1.4}{2009/04/23}{\cs{trivfloat} now accepts a comma-list of +% new float types} % The package itself provides only a single command to the user, -% \cmd{\trivfloat}. This takes a single argument \marg{name}, which -% will be the name of the new floating environment. The new -% environment can be used as normal; the new floats should behave -% exactly the same as |figure| and |table| environments. The -% |trivfloat| package works hard to ensure that the newly-produced -% floats behave exactly like pre-defined ones. The exact behaviour -% of the new floats is dependant on the document class used: -% |trivfloat| knows about the standard classes, |memoir| and -% \textsc{koma}-Script. The \cmd{\trivfloat} command should only be -% used in the preamble of the document; LaTeX will complain if you -% use it later. New floats can also be generated by passing the name -% of the desired float type to the package as an option. In this way -% several new floats can be produced in on go. The new floats will -% respect the normal position modifiers, \texttt{t}, \texttt{b}, -% \texttt{h}, \texttt{p} and (if |memoir| is not in use) \texttt{H} -% for \emph{really} here. -% -% The |trivfloat| package defines a new environment \meta{float} for -% each new float, which should be used in the same way as a figure or -% table environment. The command \texttt{\textbackslash -% \meta{float}name} is provided for the naming of float captions. In -% analogy to \cmd{\figurename} and \cmd{\tablename}, the default -% value is ``\emph{Float}.'' Secondly, the \texttt{\textbackslash -% listof\meta{float}s} command is defined. This will produce a list -% of the new float types, in the same way as \cmd{\listoffigures} -% gives a figure listing. The title text for this is stored in -% \texttt{\textbackslash list\meta{float}name}, and defaults to -% ``List of \emph{Float}s.'' Both can be redefined either by the -% user or using the |babel| \cmd{\addto} method if -% needed.\footnote{For a recent discussion of controlling -% \texttt{babel} see: \emph{Enjoying babel}, E.~Gregorio, -% \emph{TUGboat}, \textbf{2007}, \emph{28}, 247--255.} Notice that -% the capitalisation of the float name for the naming commands only -% alters the first letter of the name given. -% -% An example of the use of the package would be to create a new float -% type for charts, by having |\trivfloat{chart}| in the preamble. In -% the body of the document, one can then use |\begin{chart}| \ldots -% |\end{chart}| to have a floating chart. This will result in -% \cmd{\chartname} having the value ``Chart,'' and -% \cmd{\listchartname} taking the value ``List of Charts.'' A -% listing of all of the charts in the document would be obtained -% using \cmd{\listofcharts} (needing two LaTeX runs as normal). -% +% \cmd{\trivfloat}. This takes a single argument \marg{name}, a +% comma-separated list of new floating environments. The new +% environment scan be used as normal; the new floats should behave +% exactly the same as \texttt{figure} and \texttt{table} environments. +% The \cs{trivfloat} macro does not check for an existing definition +% of \meta{float}: any existing definition will be overwritten. +% +% As an example, this file has in the preamble the line: +%\begin{LaTeXdemo}[code only] +% \trivfloat{graph} +%\end{LaTeXdemo} +% This allows the ready production of floating graphs: +%\begin{LaTeXdemo}[code and float] +% \begin{graph} +% \centering +% Something for a graph +% \caption{My graph} +% \end{graph} +%\end{LaTeXdemo} +% and also lists of graphs +%\begin{LaTeXdemo} +% \listofgraphs +%\end{LaTeXdemo} +% +% The \pkg{trivfloat} package works hard to ensure that the +% newly-produced floats behave exactly like pre-defined ones. The +% exact behaviour of the new floats is dependant on the document +% class used: \pkg{trivfloat} knows about the standard classes, +% \pkg{memoir} and \textsc{koma}-Script. The \cs{trivfloat} command +% should only be used in the preamble of the document: \LaTeX\ will +% complain if you use it later. New floats can also be generated by +% passing the name of the desired float type to the package as an option. +% +% The new floats will respect the normal position modifiers, \texttt{t}, +% \texttt{b}, \texttt{h}, \texttt{p} and (if \pkg{memoir} is not in use) +% \texttt{H} for \emph{really} here. +% +%\DescribeOption{floatrow} +%\changes{v1.4}{2009/04/23}{Support for \textsf{floatrow} package} +% \pkg{trivfloat} will use the \pkg{float} package to produce new +% floats, unless the \pkg{memoir} class is in use. The package +% will accept the load time option \opt{floatrow}, which will instead +% use the \pkg{floatrow} package to produce floats. If either +% \pkg{float} or \pkg{floatrow} is loaded before \pkg{trivfloat}, the +% loaded package will be used irrespective of this option. +% +% When the \pkg{memoir} class is in use, the built-in function is used +% to produce floats. If the user has loaded \pkg{float} or +% \pkg{floatrow}, this will be safely detected. +% %\section{Known issues} % -% Some of the issues known to the package author are quite -% complicated, and most users will probably never encounter them. -% They are marked with a ``dangerous bend'' sign, and should be -% skipped by inexperienced TeX users. +% If you wish to redefine \texttt{\textbackslash the\meta{float}}, to +% alter the number format, then you must do this after +% |\begin{document}|. This is to allow \pkg{trivfloat} to work correctly +% with \pkg{hyperref}. % -% The name passed to \cmd{\trivfloat} should contain only the letters +% The name passed to \cs{trivfloat} should contain only the letters % A--Z and a--z. This ensures that there are no strange errors -% generated by TeX. Correctly handling non-English words is not +% generated by \TeX. Correctly handling non-English words is not % possible using an automated system, and so after defining a new % float type the macros \texttt{\textbackslash\meta{float}name} and % \texttt{\textbackslash list\meta{float}name} should be corrected to -% give the desired names. If you \emph{really} need to use other -% characters, read the ``dangerous bend.'' +% give the desired names. % -% The |babel| system provides support for a wide range of +% The \pkg{babel} system provides support for a wide range of % language-specific strings. It also makes changes to the typography -% of documents. The changes made by |babel| can be in almost any -% area, and so floats created with |trivfloat| may not act like the -% standard ones once |babel| is loaded. For example, the |french| -% option for babel alters the internal function used to make float -% captions. Users should search through the +% of documents. The changes made by \pkg{babel} can be in almost any +% area, and so floats created with \pkg{trivfloat} may not act like the +% standard ones once \pkg{babel} is loaded. For example, the +% \opt{french} option for \pkg{babel} alters the internal function used +% to make float captions. Users should search through the % \texttt{\meta{language}.ldf} file for the languages they use for -% ``figure'' and ``lof'' to see what changes |babel| makes to the +% ``figure'' and ``lof'' to see what changes \pkg{babel} makes to the % standard floats. The user can then correct the behaviour of the -% new floats as needed. -% -%\iffalse meta-comment -% The following is a quick hack for a ``dangerous bend'' text. -% No text scaling or anything like that is done! -%\fi -%\font\manual=manfnt -%\def\dbend{{\manual\char127}} -%\def\danger{\begin{trivlist}\item[]\noindent -%\begingroup\hangindent=3pc\hangafter=-2\small -%\def\par{\endgraf\endgroup} -%\hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces} -%\def\enddanger{\par\end{trivlist}} -%\begin{danger} -% The float-forming mechanism \emph{will} accept characters which are -% not regarded by TeX as ``letters'' as it uses \cmd{\csname} \ldots -% \cmd{\endcsname} to generate the new float type. However, very odd -% and hard to locate errors may occur if this is done. With some -% document classes (\emph{e.g.}~|article|) all seems to work, but -% other classes (\emph{e.g.}~|book|) cause TeX to complain. As a -% result, all characters passed to \cmd{\trivfloat} should be have a -% catcode of 11. If you attempt to use character that is not a single -% character (say for example \cmd{\ss} for \ss) things will go badly -% wrong. Stick to letters. -%\end{danger} -% -%\StopEventually{} -% -% \iffalse -%<*package> -% \fi +% new floats as needed. +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} % -% \section{Implementation} +%\section{Implementation} % -% \subsection{Setup code} -% -% The first part of the package is concerned with basic -% identification and loading support packages. +%\begin{macro}{\iftfl@floatrow} +% There is a choice: use \pkg{float} or use \pkg{floatrow}. % \begin{macrocode} -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{trivfloat} - [2007/09/20 v1.3b Quick floats in LaTeX] +%<*package> +\newif\iftfl@floatrow % \end{macrocode} -% |memoir| has its own \cmd{\newfloat} mechanism, and so |float| is -% used only if |memoir| is not loaded. +%\end{macro} +%\begin{macro}{\tlf@make@execute} +%\begin{macro}{\tlf@make@pkg} +% So that things work easily, the name of the package used to generate +% floats is stored for later use. The command to execute everything is +% also stored, as \pkg{floatrow} needs things to happen earlier than +% \pkg{float} or \pkg{memoir}. +% \begin{macrocode} +\newcommand*{\tfl@make@execute}{} +\newcommand*{\tfl@make@pkg}{} +% \end{macrocode} +%\end{macro} +%\end{macro} +% +% Option handling, including some faked key--value input. % \begin{macrocode} -\@ifclassloaded{memoir} - {} - {\RequirePackage{float}} +\DeclareOption{floatrow}{\tfl@floatrowtrue} +\DeclareOption{floatrow=true}{\tfl@floatrowtrue} +\DeclareOption{floatrow=false}{\tfl@floatrowfalse} +\DeclareOption*{% + \expandafterAtEndOfPackage\expandafter{% + \expandafter\trivfloat\expandafter{\CurrentOption}% + }% +} +\ProcessOptions\relax % \end{macrocode} +% +% With options processed, the appropriate packages can be loaded as +% necessary. The are some checks so that only one package is tried. The +% order here means that \pkg{memoir} users can choose to load +% \pkg{float} or \pkg{floatrow} if they use the extra functionality. +% \begin{macrocode} +\@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 + }% + }% +} +% \end{macrocode} % -% \subsection{Internal macros} +%\begin{macro}{tfl@float@cnt} +% A track is needed of the number of floats created. +% \begin{macrocode} +\newcounter{tfl@float@cnt} +% \end{macrocode} +%\end{macro} +%\begin{macro}{\tfl@floatname} +% The name of the float currently being made. +% \begin{macrocode} +\newcommand*{\tfl@floatname}{} +% \end{macrocode} +%\end{macro} % -%\begin{macro}{\tfl@floatcount} -% A new counter is needed to track how many floats have been -% generated by |trivfloat|. +%\begin{macro}{\tfl@chapter} +%\begin{macro}{\tfl@chapter@hook} +% A method to add to the \cs{@chapter} macro is needed. This is +% not compatible with \cs{g@addto@macro} directly, so a more +% complex method is used by providing a suitable hook. % \begin{macrocode} -\newcount\tfl@floatcount% +\newcommand*{\tfl@chapter@hook}{} +\newcommand*{\tfl@chapter}{} +\ifx\@chapter\@undefined\else + \let\tfl@chapter\@chapter + \renewcommand*{\@chapter}{% + \tfl@chapter@hook + \tfl@chapter + } +\fi % \end{macrocode} %\end{macro} -%\begin{macro}{\tfl@genext} +%\end{macro} +%\begin{macro}{\tfl@chapter@fix} +% So that floats inside chapters work correctly. +% \begin{macrocode} +\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}% + }% + }{}% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\tfl@generate@ext} %\changes{v1.2}{2007/08/20}{Removed \texttt{los} from list of possible % extensions} %\begin{macro}{\tfl@ext} % Each float type needs a list to store entries when generating a % contents listing. Rather than try complex things with the initial % characters of the float name, an arbitrary file extension is used. -% The extensions |lof|, |log| and |lot| are taken by default, so we -% don't use them. The |chemscheme| package uses |los|, so this is -% left alone as well. Also notice that if people try to make too many -% new float types, then extension |xxx| will be used. This is very -% unlikely, but odd things might happen so we warn them. -% \begin{macrocode} -\def\tfl@genext{% - \def\tfl@ext{% - \ifcase\tfl@floatcount% -% \end{macrocode} -% Zero is not a possibility for \cmd{\tfl@floatcount} is not a -% possibility, so this is skipped over. +% The extensions \texttt{lof}, \texttt{log} and \texttt{lot} are taken +% by default, so they are not used. The \pkg{chemscheme} package uses +% \texttt{los}, so this is left alone as well. Also notice that if +% people try to make too many new float types, then extension +% \texttt{xxx} will be used. This is very unlikely, but odd things +% might happen so we warn them. % \begin{macrocode} +\newcommand*{\tfl@generate@ext}{% + \edef\tfl@ext{% + \ifcase\value{tfl@float@cnt}% 0 not possible \or % 1 loa% \or % 2 @@ -321,37 +548,169 @@ \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 }% }% % \end{macrocode} %\end{macro} %\end{macro} +% +%\begin{macro}{\tfl@make@float} +% When using \pkg{float}, definition depends on the existence of +% chapters. The name and ``list of'' macros are then created separately. +% \begin{macrocode} +\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}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\tfl@make@floatrow} +% For \pkg{floatrow}, the interface to everything is rather simple. The +% name here cannot use the original macros created by \pkg{trivfloat}, +% which results in an infinite loop. +% \begin{macrocode} +\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}}% + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\tfl@make@memoir} +% \pkg{memoir} has a lot of things to set up for a float. This list is +% essentially the same as the \pkg{memoir} kernel uses. +% \begin{macrocode} +\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 +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\tfl@make@names} +% The names for things are made in the same way for all float generation +% methods. The plural here is of course a guess! +% \begin{macrocode} +\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 + }% +} +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\tfl@trivfloat} +% The internal macro which does the work. The \cs{edef} here makes sure +% that the name and extension are correct. +% \begin{macrocode} +\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 +} +% \end{macrocode} +%\end{macro} +% %\begin{macro}{\tfl@uppercase} +%\begin{macro}{\tfl@uppercase@aux} %\changes{v1.3a}{2007/08/22}{New macro} % To get the correct kerning, a customised version of -% \cmd{\MakeUppercase} is needed. Normally you are not supposed to -% use \cmd{\reserved@a} and \cmd{\reserved@b}, but the code here is a -% very minor alteration of the LaTeX kernel code, so these macros are -% retained. The use of \cmd{\DeclareRobustCommand} here is essential. +% \cs{MakeUppercase} is needed. The use of +% \cs{DeclareRobustCommand} here is essential. The change here is that +% the upper-cased letter is available outside of the group, hence using +% \cs{tfl@uppercase@aux} rather than \cs{reserved@a} as in the original. % \begin{macrocode} -\DeclareRobustCommand\tfl@uppercase[1]{% +\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}}% -% \end{macrocode} -% The change from the kernel version comes here. -% \begin{macrocode} - \expandafter}\reserved@a -}% + \protected@edef\tfl@uppercase@aux{\uppercase{#1}}% + \expandafter}% + \tfl@uppercase@aux +} +\newcommand*{\tfl@uppercase@aux}{} % \end{macrocode} %\end{macro} +%\end{macro} %\begin{macro}{\tfl@upperfirst} %\changes{v1.2}{2007/08/20}{Made names change case correctly} %\changes{v1.3}{2007/08/21}{Replaces \cs{tfl@genname} and @@ -364,166 +723,54 @@ % mean that the user is responsible for the case of everything except % the first letter. % \begin{macrocode} -\def\tfl@upperfirst#1{% +\newcommand*{\tfl@upperfirst}[1]{% \protect\@gobble\noexpand\tfl@uppercase#1% } % \end{macrocode} %\end{macro} -%\begin{macro}{\tfl@chapter} -%\begin{macro}{\tfl@orig@chapter} -%\begin{macro}{\tfl@chapter@hook} -% A method to add to the \cmd{\@chapter} macro is needed. This is -% not compatible with \cmd{\g@addto@macro} directly, so a more -% complex method is used by providing a suitable hook. -% \begin{macrocode} -\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 -% \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} -% -% \subsection{User space macros} % %\begin{macro}{\trivfloat} -% The only user-facing macro we need is |\trivfloat|. This does the -% work of setting up the new float type. Thanks to Heiko Oberdiek for -% the method to expand arguments correctly: needed so that -% \cmd{\tfl@ext} has the correct value. %\changes{v1.3}{2007/08/21}{Removed redundant numeral-based code} +%\changes{v1.4}{2009/04/23}{Extended to accept a comma-separated list} +% The user \cs{trivfloat} macro works by looping over each new float and +% calling the internal macro \cs{tfl@trivfloat} % \begin{macrocode} \newcommand*{\trivfloat}[1]{% - \AtBeginDocument{% - \advance\tfl@floatcount\@ne% - \tfl@genext% - \PackageInfo{trivfloat}% - {Listing all ``#1'' floats in \jobname.\tfl@ext}% -% \end{macrocode} -% The first step for forming a new float type is to create the -% \texttt{\textbackslash \meta{float}name} and -% \texttt{\textbackslash list\meta{float}name} macros. -%\changes{v1.2}{2007/08/20}{Create ``name'' commands rather than -% using text directly} -%\changes{v1.3}{2007/08/21}{Use \cs{newcommand*} for ``name'' -% commands} -% \begin{macrocode} - \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% -% \end{macrocode} -%\changes{v1.2}{2007/08/20}{Added \texttt{memoir}-specific code} -% The |memoir|-dependent code now occurs. The case when |memoir| -% is in use is handled first. -% \begin{macrocode} - \@ifclassloaded{memoir} - {\noexpand\newfloat[chapter]{#1}{\tfl@ext} - {\csname #1name\endcsname} - \noexpand\newlistof{listof#1s}{\tfl@ext} - {\csname list#1name\endcsname} -% \end{macrocode} -% The following deals with the vertical space in list of float tables -% that occurs between each chapter. -% \begin{macrocode} - \noexpand\addtodef{\noexpand\insertchapterspace}{}% - {\noexpand\addtocontents% - {\tfl@ext} - {\noexpand\protect\noexpand\addvspace{10pt}}} - \noexpand\newlistentry[chapter]{#1} - {\tfl@ext}{0}} -% \end{macrocode} -% The creation of new floats needs to know if the document class is -% using chapters, when |memoir| is not in use. -%\changes{v1.2}{2007/08/20}{Added chapter detection} -% \begin{macrocode} - {\ifx\chapter\@undefined - \noexpand\newfloat{#1}{tbp}{\tfl@ext} - \else - \noexpand\newfloat{#1}{tbp}{\tfl@ext}[chapter] - \fi -% \end{macrocode} -%\changes{v1.2}{2007/08/20}{Removed auxiliary macro \cs{tfl@list}} -% The naming of floats for captions and generation of a list of -% floats is now handled. -% \begin{macrocode} - \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% -% \end{macrocode} -% Except for \textsc{koma}-Script, all of the supported document -% classes need some further hacks to get behaviour equivalent to the -% normal float types. None of these need to have access to the -% \cmd{\tfl@ext}, so are safe outside the \cmd{\edef} above. |memoir| -% does various low-level things, which are reproduced first. Here, -% \cmd{\@ifclassloaded} can be used as |\iftfl@memoir| leads to |\if| -% nesting errors. -% \begin{macrocode} - \@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}} -% \end{macrocode} -% The standard document classes do not print the chapter number -% in captions if it is not greater than zero. -% \begin{macrocode} - {\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} - } -}% -% \end{macrocode} -%\changes{v1.2}{2007/08/20}{Only in preamble} -% The necessary patching can only be done in the preamble, so -% \cmd{\trivfloat} is banned elsewhere. -% \begin{macrocode} + \@for\tfl@floatname:=#1\do{% + \tfl@trivfloat + }% +} \@onlypreamble\trivfloat % \end{macrocode} -% \end{macro} -% -% \subsection{Package options} -% -% Any package options given are assumed to be new float types. -% Every option is therefore passed to \cmd{\trivfloat}. +%\end{macro} +% +%\begin{macro}{\tfl@bgroup} +%\begin{macro}{\tfl@egroup} +%\begin{macro}{\tfl@name@format} +% When using \pkg{babel} in French, the caption format gets changed. +% This has to be tested twice: once to see if \pkg{babel} was loaded +% before \pkg{trivfloat} and once afterwards. % \begin{macrocode} -\DeclareOption*{\expandafter\trivfloat\expandafter{\CurrentOption}} -\ProcessOptions +\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 + }{}% +}{}% +}% +%</package> % \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} % -% \iffalse -%</package> -% \fi -% \PrintChanges -% \PrintIndex -% \Finale +%\Finale diff --git a/Master/texmf-dist/source/latex/trivfloat/trivfloat.ins b/Master/texmf-dist/source/latex/trivfloat/trivfloat.ins index d011850c32c..2e73e6d0c8b 100644 --- a/Master/texmf-dist/source/latex/trivfloat/trivfloat.ins +++ b/Master/texmf-dist/source/latex/trivfloat/trivfloat.ins @@ -1,34 +1,71 @@ -% Copyright (C) 2007 by -% Joseph Wright <joseph.wright@morningstar2.co.uk> -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either -% version 1.3 of this license or (at your option) any later -% version. The latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of -% LaTeX version 2003/12/01 or later. -% -% This work has the LPPL maintenance status ``maintained.'' -% -% The current maintainer of this work is Joseph Wright. -% -% This work consists of the main source files trivfloat.dtx -% and trivfloat.ins and the derived files trivfloat.sty and -% trivfloat.pdf. -% -\input docstrip.tex -\askforoverwritefalse -\preamble - ---------------------------------------------------------------- - 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 - ---------------------------------------------------------------- -\endpreamble -\Msg{Generating trivfloat files:} -\usedir{tex/latex/contib/trivfloat} -\generate{\file{trivfloat.sty}{\from{trivfloat.dtx}{package}}} -\endbatchfile +%%
+%% This is file `trivfloat.ins',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% trivfloat.dtx (with options: `install')
+%% 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
+%% ----------------------------------------------------------------
+%%
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+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
+----------------------------------------------------------------
+
+\endpreamble
+\postamble
+
+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.
+
+\endpostamble
+\usedir{tex/latex/trivfloat}
+\generate{
+ \file{\jobname.sty}{\from{\jobname.dtx}{package}}
+}
+\endbatchfile
+%%
+%% 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.ins'.
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'. |