%%
%% This is file `endfloat.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% endfloat.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% This is part of a set of tools (or better yet, experiments) written
%% by Jeff Goldberg (jeffrey@goldmark.org), who is writting this
%% not only for it utility value, but as part of the process of learning
%% LaTeX.  These tools are far from perfect, and comments are welcome.
%% 
%% The usual disclaimers apply:  If it doesn't work right that's your
%% problem (but do let me know).
%% 
%% The usual GNU-style conditions apply: If you change it, you take
%% the blame; if you pass it on, pass on all present condiditions;
%% 
\def\filename{endfloat}
\def\fileversion{v2.7}
\def\filedate{2019/04/15}
\def\docdate{2019/04/15}
%% \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         \~}
%%
%% Description: LaTeX style to put figures and tables at end of article
%% Keywords: LaTeX, style-option, float, figure, table
%% Authors: James Darrell McCauley <jdm5548@diamond.tamu.edu>,
%%          Jeff Goldberg <jeffrey@goldmark.org>,
%%          Axel Sommerfeldt <axel.sommerfeldt@f-m.fm>
%% Maintainer: -none-
%% Latest Version: Version 2.7 <April 2019>
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{endfloat}[\filedate\space\fileversion\space
               LaTeX2e package puts figures and tables at end (jdm)]
\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
\newcommand*\efloat@syncobsoleteflags{%
  \efloat@ifflag{tablelist}{\@tablisttrue}{\@tablistfalse}%
  \efloat@ifflag{figurelist}{\@figlisttrue}{\@figlistfalse}%
  \efloat@ifflag{tablehead}{\@tabheadtrue}{\@tabheadfalse}%
  \efloat@ifflag{figurehead}{\@figheadtrue}{\@figheadfalse}}
\@domarkerstrue
\@tablisttrue
\@figlisttrue
\@tabheadfalse
\@figheadfalse
\@tablesfirstfalse
\efloat@figurestrue              % as
\efloat@tablestrue               % as
\efloat@listtrue                 % as
\efloat@headfalse                % as
\RequirePackage{keyval}
\newcommand*\SetupDelayedFloat[2]{%
  \def\efloat@type{#1}%
  \setkeys{endfloat}{#2}}
\define@key{endfloat}{list}[true]{\efloat@setkey{list}{#1}}
\define@key{endfloat}{nolist}[]{\efloat@setkey{list}{false}}
\define@key{endfloat}{head}[true]{\efloat@setkey{head}{#1}}
\define@key{endfloat}{nohead}[]{\efloat@setkey{head}{false}}
\newcommand*\efloat@setkey{%
  \@expandtwoargs\efloat@@setkey\efloat@type}
\newcommand*\efloat@@setkey[3]{%
  \efloat@ifdelayed{#1}{%
    \efloat@setflag{#1#2}{#3}%
    \efloat@syncobsoleteflags}}
\newcommand\efloat@ifdelayed[2]{%
  \@ifundefined{ef@ext@#1}%
    {\PackageError{endfloat}%
      {`#1' is not a delayed float type}%
      {Only environments known to the `endfloat' package are allowed here.}}%
    {#2}}%
\newcommand*\efloat@ifflag[1]{%
  \@nameuse{ef@if@#1}}
\newcommand*\efloat@setflag[2]{%
  \@nameuse{if#2}%
    \global\expandafter\let\csname ef@if@#1\endcsname\@firstoftwo
  \else
    \global\expandafter\let\csname ef@if@#1\endcsname\@secondoftwo
  \fi}%
\newcommand*\efloat@newwrite[1]{%
   \expandafter\newwrite\csname efloat@post#1\endcsname}
\newcommand*\efloat@openpost[1]{%
   \expandafter\immediate\expandafter\openout
      \csname efloat@post#1\endcsname =\jobname.#1\relax
   \ef@setct{#1}{1}%
   \message{(\jobname.#1)}}
\newcommand*\efloat@closepost[1]{%
   \expandafter\immediate\expandafter\closeout\csname efloat@post#1\endcsname
   \ef@setct{#1}{0}}
\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}
\newcommand*\efloat@condopen[1]{%
   \ef@ifct{#1}{}{\efloat@openpost{#1}}}
\providecommand\protected@iwrite[3]{%
  \begingroup
  \let\thepage\relax
  #2%
  \let\protect\@unexpandable@protect
  \edef\reserved@a{\immediate\write #1{#3}}%
  \reserved@a
  \endgroup
  \if@nobreak\ifvmode\nobreak\fi\fi}
\newcommand\efloat@iwrite[1]{%
  \expandafter\protected@iwrite\csname efloat@post#1\endcsname{}}
\newcommand\addtodelayedfloat{%
  \@ifstar{\efloat@addto\@firstofone}{\efloat@addto\detokenize}}
\newcommand\efloat@addto[3]{%
  \efloat@ifdelayed{#2}{%
    \expandafter\efloat@@addto\expandafter{\csname ef@ext@#2\endcsname}{#1{#3}}}}
\newcommand\efloat@@addto[1]{%
  \efloat@condopen{#1}\efloat@iwrite{#1}}
\providecommand\efloatheading[1]{%
  \markboth{\uppercase{#1}}{\uppercase{#1}}}
\providecommand\efloatpreamble{}
\providecommand\efloatseparator{\clearpage}
\providecommand\efloatpostamble{\efloatseparator}
\providecommand\efloatbegin{\clearpage}
\providecommand\efloatend{}
\providecommand\efloatbeginlist{\normalsize}
\providecommand\efloatendlist{\clearpage}
\newcommand*{\ef@makeinnocent}[1]{\catcode`#1=12 }
\providecommand{\figurename}{Figure}
\providecommand{\tablename}{Table}
\newcommand{\floatplace}[1]{%
   \begin{center}
     [\csname #1name\endcsname~\csname thepost#1\endcsname\ about here.]
   \end{center}}
\newcommand*\DeclareDelayedFloat{%
  \@ifstar{\efloat@declare{*}}{\efloat@declare{}}}
\@onlypreamble\DeclareDelayedFloat
\newcommand*\efloat@declare[2]{%
  \@testopt{\efloat@@declare{#1}{#2}}{ef#2}}
\@onlypreamble\efloat@declare
\def\efloat@@declare#1#2[#3]#4{%
  \newcounter{post#2}%
  \edef\@tempa{#3}%
  \edef\@tempb{\@nameuse{ext@#2}}%
  \ifx\@tempa\@tempb
    \PackageError{endfloat}%
      {File extension `\@tempa' is already used by the List}%
      {Try using a different file extension here, e.g. `ef\expandafter\@gobbletwo\@tempa'.}%
  \else
    \expandafter\let\csname ef@ext@#2\endcsname\@tempa
  \fi
  \efloat@newwrite{#3}%
  \ef@newct{#3}%
  \@ifundefined{#2name}{\@namedef{#2name}{\@nameuse{fname@#2}}}{}%
  \efloat@namedef{#2place}{\floatplace{#2}}%
  \DeclareDelayedFloatFlavor#1{#2}{#2}%
  \expandafter\providecommand\csname #2section\endcsname{#4}%
  \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
  \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
  \efloat@namedef{process#2s}{\efloat@process{#3}{#2}}%
  \efloat@namedef{process#2es}{\@nameuse{process#2s}}%
  \efloat@@setkey{#2}{list}{efloat@list}%
  \efloat@@setkey{#2}{head}{efloat@head}%
  \@cons\efloat@list{{#2}}}
\@onlypreamble\efloat@@declare
\newcommand*\efloat@list{}
\newcommand*\efloat@namedef[1]{%
  \expandafter\newcommand\csname #1\endcsname}
\newcommand*\DeclareDelayedFloatFlavor{%
  \@ifstar{\efloat@declareflavor\@gobble}%
          {\efloat@declareflavor\@iden}}
\@onlypreamble\DeclareDelayedFloatFlavor
\let\DeclareDelayedFloatFlavour\DeclareDelayedFloatFlavor
\@onlypreamble\DeclareDelayedFloatFlavour
\newcommand*\efloat@declareflavor[3]{%
  \efloat@ifdelayed{#3}{%
    \efloat@AtBeginDocument{%
      \efloat@@declareflavor{#2}{#3}%
      #1{\efloat@@declareflavor{#2*}{#3}}}}}
\@onlypreamble\efloat@declareflavor
\newcommand*\efloat@@declareflavor[2]{%
  \def\@tempa{\@efloat{#2}{#1}}%
  \@ifundefined{efloat@#1@ORI}%
    {\expandafter\expandafter\expandafter\let\expandafter
       \csname efloat@#1@ORI\expandafter\endcsname
       \csname #1\endcsname
     \expandafter\g@addto@macro\expandafter\efloat@restorefloats\expandafter{%
       \expandafter\let
         \csname #1\expandafter\endcsname
         \csname efloat@#1@ORI\endcsname}%
     \expandafter\let\csname#1\endcsname\@tempa}%
    {\expandafter\ifx\csname#1\endcsname\@tempa \else
       \PackageError{endfloat}%
         {The environment `#1' was already redefined}%
         {You can't use \noexpand\DeclareDelayedFloatFlavor twice for a given environment.}%
     \fi}}
\@onlypreamble\efloat@@declareflavor
\@ifpackageloaded{floatrow}{%
  \PackageInfo{endfloat}{`floatrow' package detected, delaying redefinitions}
  \providecommand*\efloat@AtBeginDocument{\AtBeginDocument}
}{%
  \providecommand*\efloat@AtBeginDocument{\@iden}
}
\newcommand*\efloat@restorefloats{}
\newcommand*\efloat@SetOption[1]{%
  \def\@elt##1{\efloat@Setup{##1}{#1}}%
  \efloat@list
  \let\@elt\relax}
\newcommand\efloat@Setup[2]{%
  \g@addto@macro\efloat@ProcessOptions{%
    \SetupDelayedFloat{#1}{#2}}}
\newcommand\efloat@ProcessOptions{%
  \let\efloat@SetOption\@undefined
  \let\efloat@Setup\@undefined
  \let\efloat@ProcessOptions\@undefined}
\DeclareOption{nomarkers}{\@domarkersfalse}
\DeclareOption{markers}{\@domarkerstrue}
\newcommand{\markersintext}{\@domarkerstrue}
\newcommand{\nomarkersintext}{\@domarkersfalse}
\newcommand{\dotablist}{%
  \SetupDelayedFloat{table}{list=true}}
\newcommand{\notablist}{%
  \SetupDelayedFloat{table}{list=false,head=true}}
\newcommand{\dofiglist}{%
  \SetupDelayedFloat{figure}{list=true}}
\newcommand{\nofiglist}{%
  \SetupDelayedFloat{figure}{list=false,head=true}}
\DeclareOption{nolists}{\efloat@listfalse \efloat@SetOption{list=false}}
\DeclareOption{lists}{\efloat@listtrue \efloat@SetOption{list=true}}
\DeclareOption{notablist}{\efloat@Setup{table}{list=false}}
\DeclareOption{nofiglist}{\efloat@Setup{figure}{list=false}}
\DeclareOption{tablist}{\efloat@Setup{table}{list=true}}
\DeclareOption{figlist}{\efloat@Setup{figure}{list=true}}
\DeclareOption{heads}{\efloat@headtrue \efloat@SetOption{head=true}}
\DeclareOption{noheads}{\efloat@headfalse \efloat@SetOption{head=false}}
\DeclareOption{fighead}{\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}}
\DeclareOption{tablesfirst}{\@tablesfirsttrue}
\DeclareOption{figuresfirst}{\@tablesfirstfalse}
\DeclareOption{tablesonly}{\efloat@figuresfalse \efloat@tablestrue}
\DeclareOption{figuresonly}{\efloat@figurestrue \efloat@tablesfalse}
\DeclareOption{notables}{\efloat@tablesfalse}
\DeclareOption{nofigures}{\efloat@figuresfalse}
\newcommand*\efloat@AtEndDocument{\AtEndDocument}
\DeclareOption{disable}{%
  \def\efloat@@declare#1#2[#3]#4{%
    \PackageInfo{endfloat}{`#2' is not delayed since option `disable' was specified}}%
  \renewcommand*\efloat@declareflavor[3]{}%
  \renewcommand*\efloat@@setkey[3]{}%
  \renewcommand*\efloat@AtEndDocument{\@gobble}%
  \AtBeginDocument{\renewcommand*\processdelayedfloats{}}}
\DeclareOption*{%
   \PackageError{endfloat}%
     {Unknown option `\CurrentOption'}%
     {Please take a look at the documentation of the `endfloat' package.}}
\ProcessOptions*
\let\@bfig\figure             % bj
\let\@btab\table              % bj
\if@tablesfirst
  \ifefloat@tables
    \DeclareDelayedFloat{table}[ttt]{Tables}
  \fi
  \ifefloat@figures
    \DeclareDelayedFloat{figure}[fff]{Figures}
  \fi
\else
  \ifefloat@figures
    \DeclareDelayedFloat{figure}[fff]{Figures}
  \fi
  \ifefloat@tables
    \DeclareDelayedFloat{table}[ttt]{Tables}
  \fi
\fi
\efloat@ProcessOptions
\let\c@postfig\c@postfigure
\let\c@posttbl\c@posttable
\newcommand\thepostfig{\thepostfigure}
\newcommand\theposttbl{\theposttable}
\let\efloat@float\relax
\newcommand*\@efloat[1]{%
  \expandafter\@@efloat\expandafter{\csname ef@ext@#1\endcsname}{#1}}
\newcommand*\@@efloat[3]{%
  \efloat@condopen{#1}%
  \@nameuse{efloat@separator@#1}%
  \if@domarkers
    \stepcounter{post#2}% % bj
    \@nameuse{#2place}%   % bj
  \fi
  \def\@currenvir{efloat@float}%
  \begingroup
  \let\do\ef@makeinnocent \dospecials
  \ef@makeinnocent\^^L% and whatever other special cases
  \endlinechar`\^^M \catcode`\^^M=12 %
  \efloat@patch\efloat@endtest{#3}% as
  \efloat@patch\efloat@enddbltest{#3}% as
  \efloat@patch\efloat@endtestX{#3}% as
  \efloat@patch\efloat@enddbltestX{#3}% as
  \def\next{\efloat@xfloat{#1}}%
  \next\string\begin{#3}}%
\newcommand*\efloat@foundend[2]{%
  \edef\efloat@enddbltest{\string\end{#2}}%
  \efloat@found@end{#1}}
\newcommand*\efloat@found@end[1]{%
  \efloat@iwrite{#1}{\efloat@enddbltest}%
  \global\@namedef{efloat@separator@#1}{%
    \efloat@iwrite{#1}{\string\efloatseparator}%
    \efloat@iwrite{#1}{ }}%
  \def\next{\endgroup\end{efloat@float}}}
{\catcode`\^^M=12 \endlinechar=-1 %
 \long\gdef\efloat@xfloat#1#2^^M{%
  \efloat@if@end{#2}{\efloat@found@end{#1}}{\efloat@iwrite{#1}{#2}}%
  \next}}
\newcommand\efloat@if@end[1]{%
  \def\test{#1}%
  \let\efloat@next\@firstoftwo
  \ifx\test\efloat@endtest
  \else\ifx\test\efloat@enddbltest
  \else\ifx\test\efloat@endtestX
  \else\ifx\test\efloat@enddbltestX
  \else
    \let\efloat@next\@secondoftwo
  \fi\fi\fi\fi \efloat@next}
{\escapechar=-1%
 \catcode`\#=14 % hash mark is comment character
 \catcode`\%=12 # percent sign is other character
 \xdef\efloat@endtest{\string\\end\string\{X\string\}}
 \xdef\efloat@enddbltest{\string\\end\string\{X\string\}}
 \xdef\efloat@endtestX{\string\\end\string\{X\string\}%}
 \xdef\efloat@enddbltestX{\string\\end\string\{X\string\}%}
}
\newcommand*\efloat@patch[2]{%
    \def\x##1X##2\@nil{\def#1{##1#2##2}}%
    \expandafter\x#1\@nil}
\newcommand*\ef@xfigure{\ef@xfloat{fff}{figure}}
\newcommand*\ef@xtable{\ef@xfloat{ttt}{table}}
\newcommand*\ef@xfloat[2]{%
  \efloat@patch\efloat@endtest{#2}%
  \efloat@patch\efloat@enddbltest{#2*}%
  \efloat@patch\efloat@endtestX{#2}%
  \efloat@patch\efloat@enddbltestX{#2*}%
  \def\next{\efloat@xfloat{#1}}%
  \next}
\newcommand*\processdelayedfloats@hook{}
\def\AtBeginDelayedFloats{%
   \g@addto@macro\processdelayedfloats@hook}
\newcommand*\processotherdelayedfloats{}
\newcommand*\efloat@process[2]{%
  \ef@ifct{#1}{%
    \efloat@closepost{#1}%
    \def\efloattype{#2}%                                      % as
    \efloatbegin                                              % bj
    \efloat@ifflag{#2list}{%                                  % bj
      \begingroup
        \efloatbeginlist                                      % bj
        \efloat@listof{#2}%                                   % bj
        \efloatendlist                                        % bj
      \endgroup
    }{}%
    \efloat@ifflag{#2head}{%
      \section*{\@nameuse{#2section}}%                        % bj
      \suppressfloats[t]%                                     % jpg
    }{}%
    \expandafter\expandafter\expandafter\efloatheading        % bj
      \expandafter\csname #2section\endcsname                 % bj
    \processdelayedfloat@hook
    \@nameuse{process#2s@hook}%
    \efloatpreamble
    \efloat@input{\jobname.#1}%
    \efloatpostamble
    \efloatend                                                % as
  }{}}
\newcommand*\efloat@input[1]{%
  \makeatletter
  \@input{#1}%
  \makeatother}
\newcommand*\processdelayedfloat@hook{}
\newcommand*\efloat@listof[1]{%
  \expandafter\providecommand\csname list#1name\endcsname
    {List of \@nameuse{#1section}}%
  \@ifundefined{listof#1s}%
    {\@ifundefined{listof}%
      {\PackageError{endfloat}%
         {Don't know how to make List of `#1'}%
         {You could try defining \protect\listof#1s on your own}}%
      {\listof{#1}{\@nameuse{list#1name}}}}%
    {\@nameuse{listof#1s}}}
\renewcommand{\bottomfraction}{1.0}
\renewcommand{\topfraction}{1.0}
\renewcommand{\textfraction}{0.0}
\newcommand*\processdelayedfloats{{%
  \def\baselinestretch{1}\normalsize
  \efloat@restorefloats
  \processdelayedfloats@hook
  \efloat@processfloats
  \processotherdelayedfloats}}
\newcommand*\efloat@processfloats{%
  \let\@tempa\@empty
  \def\@elt##1{\g@addto@macro\@tempa{\@nameuse{process##1es}}}%
  \efloat@list
  \let\@elt\relax
  \@tempa}
\efloat@AtEndDocument{%                                       % jpg
   \message{AED endfloat: Processing end Figures and Tables}% % jpg
   \onecolumn
   \processdelayedfloats }
\InputIfFileExists{endfloat.cfg}{%
   \typeout{*** Using endfloat.cfg ***}}{}
\endinput
%%
%% End of file `endfloat.sty'.
