diff options
author | Karl Berry <karl@freefriends.org> | 2011-12-24 23:50:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-12-24 23:50:55 +0000 |
commit | 0c4528cceb79f3a737dfba22f77cfe787889f057 (patch) | |
tree | 53d7e09e714eb40b5ed7e8f4ab1a54f072537a6d /Master/texmf-dist/source/latex/endfloat | |
parent | 46bc38f53cf814e65a94754cc5a65aa3d7d3e62d (diff) |
endfloat 2.5c (24dec11)
git-svn-id: svn://tug.org/texlive/trunk@24934 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/endfloat')
-rw-r--r-- | Master/texmf-dist/source/latex/endfloat/endfloat.dtx | 240 |
1 files changed, 174 insertions, 66 deletions
diff --git a/Master/texmf-dist/source/latex/endfloat/endfloat.dtx b/Master/texmf-dist/source/latex/endfloat/endfloat.dtx index 11f1d79f971..0d273de2141 100644 --- a/Master/texmf-dist/source/latex/endfloat/endfloat.dtx +++ b/Master/texmf-dist/source/latex/endfloat/endfloat.dtx @@ -1,9 +1,9 @@ \def\filename{endfloat} -\def\fileversion{v2.5b} -\def\filedate{2011/12/05} +\def\fileversion{v2.5c} +\def\filedate{2011/12/23} \def\docdate{2011/12/05} % -% \CheckSum{611} +% \CheckSum{706} %% \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 @@ -1433,12 +1433,9 @@ % to use the options, since these commands should be discontinued % in future versions. % -% \begin{macrocode} -\newcommand{\ef@OldCmd}[2]{\PackageWarning{endfloat}% - {The command \protect#1 is obsolete and will be\MessageBreak - omitted from future releases of the endfloat package.\MessageBreak - Use the package option `#2' instead.}} -% \end{macrocode} +% Since these commands are available now for over two decades, +% I, AS, think that it would be a bad idea removing them now. +% So I decided to drop the warning message introduced by JPG instead. % % \subsection{Flags} % @@ -1452,12 +1449,32 @@ % % \begin{macrocode} \newif\if@domarkers +\newif\if@tablist % bj \newif\if@figlist % bj +\newif\if@tabhead \newif\if@fighead \newif\if@tablesfirst \newif\ifefloat@figures % as \newif\ifefloat@tables % as +\newif\ifefloat@list % as +\newif\ifefloat@head % as +% \end{macrocode} +% +% \begin{macro}{\efloat@syncobsoleteflags} +% The switches |\if@tablist|, |\if@figlist|, |\if@tabhead|, and |\if@fighead| +% are obsolete, but still needed by some old (and unmaintained) document classes +% and packages. So we still support them, and keep them in sync with the values +% actually used by the \pkg{endfloat} package. +% \changes{v2.5c}{2011/12/22}{This macro added. as} +% \begin{macrocode} +\newcommand*\efloat@syncobsoleteflags{% + \efloat@ifflag{tablelist}{\@tablisttrue}{\@tablistfalse}% + \efloat@ifflag{figurelist}{\@figlisttrue}{\@figlistfalse}% + \efloat@ifflag{tablehead}{\@tabheadtrue}{\@tabheadfalse}% + \efloat@ifflag{figurehead}{\@figheadtrue}{\@figheadfalse}} % \end{macrocode} +% \end{macro} +% % % \subsubsection{Default values} % @@ -1465,15 +1482,20 @@ % % \begin{macrocode} \@domarkerstrue -\@figlisttrue % bj +\@tablisttrue +\@figlisttrue +\@tabheadfalse \@figheadfalse \@tablesfirstfalse \efloat@figurestrue % as \efloat@tablestrue % as +\efloat@listtrue % as +\efloat@headfalse % as % \end{macrocode} % % \begin{macro}{\SetupDelayedFloat} % \changes{v2.5}{2011/11/26}{This command added. as} +% \changes{v2.5c}{2011/12/22}{Usage of \cs{efloat@syncobsoleteflags} added. as} % While global flags will be set using package options, % environment specific flags will be set with |\Setup|\x|Delayed|\x|Float|. % \begin{macrocode} @@ -1498,7 +1520,8 @@ {\PackageError{endfloat}% {Unknown environment `#1'}% {Only environments known to the `endfloat' package are allowed here.}}% - {\efloat@setflag{#1#2}{#3}}} + {\efloat@setflag{#1#2}{#3}% + \efloat@syncobsoleteflags}} % \end{macrocode} % \end{macro} % @@ -1557,21 +1580,47 @@ % while also calling |\efloat@setflag{ttt}{true}| to set a flag % (|@ef@tttopen|) in the case of |ttt|. % \changes{v2.5a}{2011/12/04}{\cs{ef@setct} replaced by \cs{efloat@setflag}. as} +% \changes{v2.5c}{2011/12/22}{\cs{efloat@setflag} replaced by \cs{ef@setct}. as} % \begin{macrocode} \newcommand*\efloat@openpost[1]{% \expandafter\immediate\expandafter\openout \csname efloat@post#1\endcsname =\jobname.#1\relax - \efloat@setflag{#1open}{true}% + \ef@setct{#1}{1}% \message{(\jobname.#1)}} % \end{macrocode} % \end{macro} % +% \begin{macro}{\ef@newct} +% \begin{macro}{\ef@setct} +% \begin{macro}{\ef@ifct} +% |\ef@newct{ttt}| will create a new counter called |\@ef@tttopen| +% and |\ef@setct{ttt}{1}| would set it to 1.\par +% To offer best compatibility to version $2.4$ we still use these counters +% although using |\efloat@setflag{tttopen}{1}| would be a better alternative. +% (Otherwise the \pkg{apa} document class would break.) +% \changes{v2.5c}{2011/12/22}{\cs{ef@ifct} added by as} +% \begin{macrocode} +\newcommand*\ef@newct[1]{% + \expandafter \newcount \csname @ef@#1open\endcsname} +\newcommand*\ef@setct[2]{% + \expandafter\global\csname @ef@#1open\endcsname=#2\relax} +\newcommand*\ef@ifct[1]{% + \expandafter\ifnum \csname @ef@#1open\endcsname>0 \relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\efloat@condopen} % Conditionally open a file % \changes{v2.5a}{2011/12/04}{\cs{ifnum} replaced by \cs{efloat@ifflag}. as} % \begin{macrocode} \newcommand*\efloat@condopen[1]{% - \efloat@ifflag{#1open}{}{\efloat@openpost{#1}}} + \ef@ifct{#1}{}{\efloat@openpost{#1}}} % \end{macrocode} % \end{macro} % @@ -1635,6 +1684,7 @@ % \changes{v2.5}{2011/11/26}{This command added. as} % \changes{v2.5a}{2011/12/04}{\cs{ef@newct} replaced by \cs{efloat@setflag}. as} % \changes{v2.5b}{2011/12/05}{Starred variant added. as} +% \changes{v2.5c}{2011/12/22}{\cs{efloat@setflag} replaced by \cs{ef@newct}. as} % \begin{macrocode} \newcommand*\DeclareDelayedFloat{% \@ifstar{\efloat@declare{*}}{\efloat@declare{}}} @@ -1648,11 +1698,6 @@ % \begin{macrocode} \def\efloat@@declare#1#2[#3]#4{% % \end{macrocode} -% Flags: Set default values of all of the flags here. -% \begin{macrocode} - \efloat@setflag{#2list}{@figlist}% - \efloat@setflag{#2head}{@fighead}% -% \end{macrocode} % Counters % \changes{v1.99}{1992/05/27}{extensive changes by bj} % \changes{v2.1}{1994/06/25}{Modify documentation text. jpg} @@ -1674,14 +1719,14 @@ % Code for opening the |\jobname.fff| % \begin{macrocode} \efloat@newwrite{#3}% - \efloat@setflag{#3open}{false}% + \ef@newct{#3}% % \end{macrocode} % Place marker % (Note: The \pkg{float} package uses |\fname@|\textit{X} as float name, % but we need |\|\textit{X}|name| in |\float|\x|place|.) % \begin{macrocode} \@ifundefined{#2name}{\@namedef{#2name}{\@nameuse{fname@#2}}}{}% - \@namedef{#2place}{\floatplace{#2}}% + \efloat@namedef{#2place}{\floatplace{#2}}% % \end{macrocode} % Re-define float. % \begin{macrocode} @@ -1696,20 +1741,26 @@ % Here we set-up the hooks for getting stuff into |\process...| % commands easily. % \begin{macrocode} - \@namedef{efloat@#2@hook}{}% + \efloat@namedef{process#2s@hook}{}% \edef\@tempb{\def\noexpand\@tempa{\@car#2\@nil}}% \uppercase\expandafter{\@tempb}% \edef\@tempb{% \noexpand\g@addto@macro\noexpand\@tempa{\@cdr#2\@nil}}% \@tempb - \@namedef{AtBegin\@tempa s}{% - \expandafter\g@addto@macro\csname efloat@#2@hook\endcsname}% - \@namedef{AtBegin\@tempa es}{% - \expandafter\g@addto@macro\csname efloat@#2@hook\endcsname}% + \efloat@namedef{AtBegin\@tempa s}{% + \expandafter\g@addto@macro\csname process#2s@hook\endcsname}% + \expandafter\expandafter\expandafter\let\expandafter + \csname AtBegin\@tempa es\expandafter\endcsname + \csname AtBegin\@tempa s\endcsname +% \end{macrocode} +% \begin{macrocode} + \efloat@namedef{process#2s}{\efloat@process{#3}{#2}}% + \efloat@namedef{process#2es}{\@nameuse{process#2s}}% % \end{macrocode} +% Flags: Set default values of all of the flags here. % \begin{macrocode} - \@namedef{process#2s}{\efloat@process{#3}{#2}}% - \@namedef{process#2es}{\@nameuse{process#2s}}% + \efloat@@setkey{#2}{list}{efloat@list}% + \efloat@@setkey{#2}{head}{efloat@head}% % \end{macrocode} % Finally add the environment to the list of delayed floats % \begin{macrocode} @@ -1721,6 +1772,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\efloat@namedef} +% Same as \cs{@namedef} from the \LaTeX\ kernal, +% but uses \cs{newcommand} instead of \cs{def}. +% \changes{v2.5c}{2011/12/23}{This macro added} +% \begin{macrocode} +\newcommand*\efloat@namedef[1]{% + \expandafter\newcommand\csname #1\endcsname} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\DeclareDelayedFloatFlavor} % \begin{macro}{\DeclareDelayedFloatFlavour} % This one redefines the given environment, i.e. |figure| resp. |table|. @@ -1744,7 +1805,7 @@ {\PackageError{endfloat}% {Unknown environment `#3'}% {Only environments known to the `endfloat' package are allowed here.}}% - {\AtBeginDocument{% + {\efloat@AtBeginDocument{% \efloat@@declareflavor{#2}{#3}% #1{\efloat@@declareflavor{#2*}{#3}}}}} \@onlypreamble\efloat@declareflavor @@ -1782,6 +1843,24 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\efloat@AtBeginDocument} +% The \pkg{apa} and \pkg{apa6} document classes are both bound to the fact +% that the \pkg{endfloat} package is doing the redefinition of |\figure| and |\table| immediately. +% So we still do if |\def@noapacite| is defined. +% \changes{v2.5c}{2011/12/22}{This command added. as} +% \begin{macrocode} +\@ifundefined{apa@startsection}{% defined by apa.cls + \@ifundefined{@noendfloatfig}{% defined by (old) apa6.cls + \newcommand*\efloat@AtBeginDocument{\AtBeginDocument} + }{% + \newcommand*\efloat@AtBeginDocument{\@iden} + }% +}{% + \newcommand*\efloat@AtBeginDocument{\@iden} +} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\efloat@restorefloats} % Restore the original definition of all environments (floats and flavors) % known to the \pkg{endfloat} package. @@ -1842,10 +1921,8 @@ \DeclareOption{markers}{\@domarkerstrue} % \end{macrocode} % \begin{macrocode} -\newcommand{\markersintext}{\@domarkerstrue - \ef@OldCmd{\markersintext}{markers}} -\newcommand{\nomarkersintext}{\@domarkersfalse - \ef@OldCmd{\nomarkersintext}{nomarkers}} +\newcommand{\markersintext}{\@domarkerstrue} +\newcommand{\nomarkersintext}{\@domarkersfalse} % \end{macrocode} % \end{macro} % \end{macro} @@ -1859,11 +1936,9 @@ % \changes{v2.5}{2011/11/26}{We use \cs{SetupDelayedFloat} now. as} % \begin{macrocode} \newcommand{\dotablist}{% - \SetupDelayedFloat{table}{list=true}% - \ef@OldCmd{\dotablist}{tablist}} + \SetupDelayedFloat{table}{list=true}} \newcommand{\notablist}{% - \SetupDelayedFloat{table}{list=false,head=true}% - \ef@OldCmd{\notablist}{notablist}} + \SetupDelayedFloat{table}{list=false,head=true}} % \end{macrocode} % \end{macro} % \end{macro} @@ -1877,11 +1952,9 @@ % \ldots and Figures % \begin{macrocode} \newcommand{\dofiglist}{% - \SetupDelayedFloat{figure}{list=true}% - \ef@OldCmd{\dofiglist}{figlist}} + \SetupDelayedFloat{figure}{list=true}} \newcommand{\nofiglist}{% - \SetupDelayedFloat{figure}{list=false,head=true}% - \ef@OldCmd{\nofiglist}{nofiglist}} + \SetupDelayedFloat{figure}{list=false,head=true}} % \end{macrocode} % \end{macro} % \end{macro} @@ -1894,8 +1967,8 @@ % % First two new options % \begin{macrocode} -\DeclareOption{nolists}{\@figlistfalse \efloat@SetOption{list=false}} -\DeclareOption{lists}{\@figlisttrue \efloat@SetOption{list=true}} +\DeclareOption{nolists}{\efloat@listfalse \efloat@SetOption{list=false}} +\DeclareOption{lists}{\efloat@listtrue \efloat@SetOption{list=true}} % \end{macrocode} % Now the more specific ones, which must come after the more % general options to get the right interactions between semi-conflicting @@ -1914,13 +1987,13 @@ % |noheads| it ensures that |fighead| will be in effect if both % are specified. % \begin{macrocode} -\DeclareOption{heads}{\@figheadtrue \efloat@SetOption{head=true}} -\DeclareOption{noheads}{\@figheadfalse \efloat@SetOption{head=false}} +\DeclareOption{heads}{\efloat@headtrue \efloat@SetOption{head=true}} +\DeclareOption{noheads}{\efloat@headfalse \efloat@SetOption{head=false}} % \end{macrocode} % \begin{macrocode} \DeclareOption{fighead}{\efloat@Setup{figure}{head=true}} -\DeclareOption{tabhead}{\efloat@Setup{table}{head=false}} -\DeclareOption{nofighead}{\efloat@Setup{figure}{head=true}} +\DeclareOption{tabhead}{\efloat@Setup{table}{head=true}} +\DeclareOption{nofighead}{\efloat@Setup{figure}{head=false}} \DeclareOption{notabhead}{\efloat@Setup{table}{head=false}} % \end{macrocode} % Also need option for putting tables first @@ -2059,9 +2132,10 @@ \ef@makeinnocent\^^L% and whatever other special cases \endlinechar`\^^M \catcode`\^^M=12 % % \end{macrocode} -% Patch |\ef@endfiguretest| so it contains the actual environment name. +% Patch |\efloat@endtest| so it contains the actual environment name. % \begin{macrocode} - \efloat@patch\ef@endfiguretest{#3}% as + \efloat@patch\efloat@endtest{#3}% as + \efloat@patch\efloat@enddbltest{#3}% as % \end{macrocode} % We have read a |\begin{figure}| to get here. We need to write that % into the file. \par @@ -2069,7 +2143,7 @@ % gets written, but that leaves any float specifiers that had % been employed by the user wandering around in the floated material. % \begin{macrocode} - \def\next{\ef@xfigure{#1}}% + \def\next{\efloat@xfloat{#1}}% \next\string\begin{#3}}% % \end{macrocode} % \end{macro} @@ -2083,7 +2157,7 @@ % \pkg{endfloat} package which uses it will still work. % \begin{macrocode} \newcommand*\efloat@foundend[2]{% - \efloat@iwrite{#1}{\string\end{#2}}% + \edef\efloat@enddbltest{\string\end{#2}}% \efloat@found@end{#1}} % \end{macrocode} % \end{macro} @@ -2094,14 +2168,15 @@ % \changes{v2.5}{2011/11/26}{This variant of \cs{efloat@foundend} added by as} % \begin{macrocode} \newcommand*\efloat@found@end[1]{% + \efloat@iwrite{#1}{\efloat@enddbltest}% \def\next{\endgroup\end{efloat@float}% \efloat@iwrite{#1}{\string\efloatseparator}% \efloat@iwrite{#1}{ }}}% % \end{macrocode} % \end{macro} % -% \begin{macro}{\ef@xfigure} -% |\ef@xfigure| reads line by line, checking whether each line +% \begin{macro}{\efloat@xfloat} +% |\ef@xfloat| reads line by line, checking whether each line % is the |\end{figure}|. If it is, then write out end stuff % to the file. Otherwise write out read in line to the % file and do the |\next| line. @@ -2109,26 +2184,33 @@ % \changes{v2.1b}{1994/07/03}{Modify documentation -jpg} % \changes{v2.5}{2011/11/26}{universalized by as} % \changes{v2.5}{2011/11/26}{\cs{long} added. as} +% \changes{v2.5c}{2011/12/22}{renamed from \cs{ef@xfigure} to \cs{efloat@xfloat} by as} % \begin{macrocode} {\catcode`\^^M=12 \endlinechar=-1 % - \long\gdef\ef@xfigure#1#2^^M{\def\test{#2}% + \long\gdef\efloat@xfloat#1#2^^M{\def\test{#2}% % \end{macrocode} -% We have a line of text in the -% body of the figure which should be written to the file. +% Test for |\end{figure}| % \begin{macrocode} - \efloat@iwrite{#1}{#2}% + \ifx\test\efloat@endtest + \efloat@found@end{#1}% % \end{macrocode} -% Test for |\end{figure}| +% Test for |\end{figure*}| % \begin{macrocode} - \ifx\test\ef@endfiguretest + \else\ifx\test\efloat@enddbltest \efloat@found@end{#1}% % \end{macrocode} +% Finally, if none of the above, we have a line of text in the +% body of the figure which should be written to the file. +% \begin{macrocode} + \else + \efloat@iwrite{#1}{#2}% +% \end{macrocode} % \begin{macrocode} - \fi \next}} + \fi \fi \next}} % \end{macrocode} % \end{macro} % -% \begin{macro}{\ef@endfiguretest} +% \begin{macro}{\efloat@endtest} % \iffalse % Generalizing these end\ldots{}test so that they % can be used for user specified floating environments will @@ -2146,7 +2228,8 @@ % \changes{v2.5}{2011/11/26}{`figure' replaced by 'X' and documentation modified. as} % \begin{macrocode} {\escapechar=-1% - \xdef\ef@endfiguretest{\string\\end\string\{X\string\}} + \xdef\efloat@endtest{\string\\end\string\{X\string\}} + \xdef\efloat@enddbltest{\string\\end\string\{X\string\}} } % \end{macrocode} % \begin{macrocode} @@ -2156,6 +2239,30 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\ef@xfigure} +% \changes{v2.5c}{2011/12/22}{Revived by as} +% \begin{macro}{\ef@xtable} +% \changes{v2.5c}{2011/12/22}{Revived by as} +% Both, |\ef@xfigure| and |\ef@xtable|, are gone with version $2.5$ of the \pkg{endfloat} +% package. +% But unfortunately some old and unmaintained document classes and packages still +% uses these internal macros, so we still provide them to stay compatible. +% \begin{macrocode} +\newcommand*\ef@xfigure{\ef@xfloat{fff}{figure}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\ef@xtable{\ef@xfloat{ttt}{table}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\ef@xfloat[2]{% + \efloat@patch\efloat@endtest{#2}% + \efloat@patch\efloat@enddbltest{#2*}% + \def\next{\efloat@xfloat{#1}}% + \next} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Processing Figures and Tables} % % \begin{macro}{\AtBeginDelayedFloats} @@ -2164,10 +2271,10 @@ % in \file{classes.dtx}. I was about to write it myself, when I realized that % it must already exist for things like |\AtBeginDocument|. % \begin{macrocode} -\newcommand{\processdelayedfloats@hook}{} +\newcommand*\processdelayedfloats@hook{} \def\AtBeginDelayedFloats{% \g@addto@macro\processdelayedfloats@hook} -\newcommand{\processotherdelayedfloats}{} +\newcommand*\processotherdelayedfloats{} % \end{macrocode} % \end{macro} % @@ -2178,18 +2285,19 @@ % \changes{v2.5}{2011/11/26}{universalized by as} % \changes{v2.5a}{2011/12/04}{\cs{ifnum} replaced by \cs{efloat@ifflag}. as} % \changes{v2.5a}{2011/12/04}{\cs{ef@setct} replaced by \cs{efloat@setflag}. as} +% \changes{v2.5c}{2011/12/22}{\cs{efloat@setflag} replaced by \cs{ef@setct}. as} % \begin{macrocode} \newcommand*\efloat@process[2]{% % \end{macrocode} % First test to see if there are any figures to process. % If so do it. % \begin{macrocode} - \efloat@ifflag{#1open}{% + \ef@ifct{#1}{% % \end{macrocode} % Close the file for writing. Set a flag saying so. % \begin{macrocode} \expandafter\immediate\expandafter\closeout\csname efloat@post#1\endcsname - \efloat@setflag{#1open}{false}% + \ef@setct{#1}{0}% % \end{macrocode} % Deal with headers and list of figures if necessary % \begin{macrocode} @@ -2214,7 +2322,7 @@ % \end{macrocode} % Use any user defined hooks just before inputting the file. % \begin{macrocode} - \@nameuse{efloat@#2@hook}% + \@nameuse{process#2s@hook}% \@input{\jobname.#1}% }{}} % \end{macrocode} |