From c7fbeeaff8d1548d8bb4dc7e3e4dd49846d0e974 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 22 Jul 2015 23:01:13 +0000
Subject: morefloats (22jul15)

git-svn-id: svn://tug.org/texlive/trunk@37927 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/morefloats/morefloats.sty | 147 ++++++++++++---------
 1 file changed, 81 insertions(+), 66 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/morefloats/morefloats.sty')

diff --git a/Master/texmf-dist/tex/latex/morefloats/morefloats.sty b/Master/texmf-dist/tex/latex/morefloats/morefloats.sty
index 5199a1e9b2a..c79436a977b 100644
--- a/Master/texmf-dist/tex/latex/morefloats/morefloats.sty
+++ b/Master/texmf-dist/tex/latex/morefloats/morefloats.sty
@@ -9,7 +9,7 @@
 %% This is a generated file.
 %% 
 %% Project: morefloats
-%% Version: 2015/07/16 v1.0g
+%% Version: 2015/07/22 v1.0h
 %% 
 %% Copyright (C) 2010 - 2015 by
 %%     H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
@@ -56,8 +56,8 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2011/06/27]
 %% The current format at the time of the release of this version of the
-%% morefloats package was 2015/01/01.
-\ProvidesPackage{morefloats}[2015/07/16 v1.0g
+%% morefloats package was 2015/01/01, patch level 2.
+\ProvidesPackage{morefloats}[2015/07/22 v1.0h
             Raise limit of unprocessed floats (HMM)]
 
 \RequirePackage{kvoptions}[2011/06/30]% v3.11
@@ -78,22 +78,31 @@
     \gdef\morefloats@maxfloats{36}%
     \gdef\morefloats@morefloats{18}%
   \else%
-    \@tempcnta=\morefloats@morefloats\relax%
-    \ifnum\@tempcnta>1569\relax%
+    \ifnum\morefloats@morefloats>1569\relax%
       \PackageWarning{morefloats}{%
         \morefloats@morefloats\space more floats requested.\MessageBreak%
         LaTeX might run out of memory before this\MessageBreak%
         (in which case it will notify you)\MessageBreak%
        }%
+    \else%
+      \PackageInfo{morefloats}{%
+        \morefloats@morefloats\space more floats requested.\MessageBreak%
+        LaTeX might run out of memory before this\MessageBreak%
+        (in which case it will notify you)\MessageBreak%
+       }%
     \fi%
-    \advance \@tempcnta by +18%
+    \@tempcnta=\morefloats@morefloats\relax%
+    \advance\@tempcnta by +18%
     \xdef\morefloats@maxfloats{\the\@tempcnta}%
   \fi%
 \else%
   \ifx\morefloats@morefloats\@empty%
     \@tempcnta=\morefloats@maxfloats\relax%
-    \advance \@tempcnta by -18%
+    \advance\@tempcnta by -18%
     \xdef\morefloats@morefloats{\the\@tempcnta}%
+    \ifnum\morefloats@morefloats<\z@\relax% i.e. \morefloats@maxfloats < 18
+      \gdef\morefloats@morefloats{0}%
+    \fi%
     \ifnum\morefloats@maxfloats>1587\relax%
       \PackageWarning{morefloats}{%
         \morefloats@maxfloats\space floats requested.\MessageBreak%
@@ -105,7 +114,7 @@
 \fi%
 
 \@tempcnta=\morefloats@maxfloats\relax%
-\edef\morefloats@max{\the\@tempcnta}%
+\xdef\morefloats@max{\the\@tempcnta}%
 
 \ifnum\@tempcnta<18\relax%
   \PackageError{morefloats}{Option maxfloats is \the\@tempcnta<18}{%
@@ -117,9 +126,9 @@
 \fi%
 
 \@tempcnta=\morefloats@morefloats\relax%
-\edef\morefloats@more{\the\@tempcnta}%
+\xdef\morefloats@more{\the\@tempcnta}%
 
-\ifnum\@tempcnta<0\relax%
+\ifnum\@tempcnta<\z@\relax%
   \PackageError{morefloats}{Option morefloats is \the\@tempcnta<0}{%
     morefloats must be a number equal to or larger than 0\MessageBreak%
     (or not used at all).\MessageBreak%
@@ -131,8 +140,8 @@
 \@tempcnta=18\relax%
 \advance\@tempcnta by \morefloats@more%
 \advance\@tempcnta by -\morefloats@max%
-\edef\morefloats@mx{\the\@tempcnta}%
-\ifnum\morefloats@mx=0\relax% OK
+\xdef\morefloats@mx{\the\@tempcnta}%
+\ifnum\morefloats@mx=\z@\relax%
   \@tempcnta=\morefloats@maxfloats\relax%
 \else%
   \PackageError{morefloats}{%
@@ -142,7 +151,7 @@
     but it is maxfloats=\morefloats@maxfloats\space and %
     morefloats=\morefloats@morefloats .\MessageBreak%
     }%
-  \ifnum \@tempcnta<0% \morefloats@max > \morefloats@more
+  \ifnum\@tempcnta<\z@% \morefloats@max > \morefloats@more
     \@tempcnta=\morefloats@maxfloats\relax%
   \else% \@tempcnta>0, \morefloats@max < \morefloats@more
     \@tempcnta=18\relax%
@@ -151,7 +160,7 @@
 \fi%
 \edef\morefloats@mx{\the\@tempcnta}%
 \xdef\morefloats@maxfloats{\the\@tempcnta}%
-\advance\@tempcnta by -18
+\advance\@tempcnta by -18\relax%
 \xdef\morefloats@morefloats{\the\@tempcnta}%
 \gdef\morefloats@test{1}%
 \ifx\morefloats@morefloats\morefloats@test\relax%
@@ -172,58 +181,77 @@
 \fi%
 
 %% Test for new mechanism in LaTeX 2015:
-\gdef\morefloats@efa{0}%
 \ifx\e@alloc\@undefined\relax%
   %% This is an old LaTeX format, \extrafloats is not available.
   \PackageWarning{morefloats}{%
-    \fmtname\space <\fmtversion> found.\MessageBreak%
-    LaTeX 2015/01/01 is now available\MessageBreak%
+    \fmtname\space <\fmtversion> %
+    \ifx\patch@level\@undefined\relax%
+    \else patch level \patch@level%
+    \fi%
+    \MessageBreak%
+    found. At least\MessageBreak%
+    LaTeX2e <2015/01/01> patch level 2\MessageBreak%
+    is now available\MessageBreak%
     and can handle even more floats%
     \@gobble%
    }%
-  %\gdef\morefloats@efa{0}, but it already has this value
 \else%
-  %% This is new in LaTeX 2015, \extrafloats is available,
-  %% but older versions of the etex package are incompatible.
+  %% This is new in LaTeX 2015, \extrafloats is available.
   \@ifpackageloaded{etex}%
-  {% etex package loaded
-   \PackageError{morefloats}{etex package loaded}{%
-     The etex package was loaded\MessageBreak%
-     but breaks the \string\extrafloats\space command.\MessageBreak%
-     Therefore now not more than 256 floats will be available.\MessageBreak%
-     }%
-   %\gdef\morefloats@efa{0}, but it already has this value
+  {%% etex package loaded:
+   %% "it overwrites all the new allocation system
+   %% so really \extrafloats shouldn't be expected to work"
+   %% (D. Carlisle, 2015/07/16, who also provided the following
+   %% \extrafloats redefinition).
+   \gdef\extrafloats#1{%
+     \ifnum#1>\z@\relax%
+       \count@\numexpr\float@count-1\relax%
+       \ch@ck0\count@\count\relax%
+       \ch@ck1\count@\dimen\relax%
+       \ch@ck2\count@\skip\relax%
+       \ch@ck4\count@\box\relax%
+       \e@alloc@chardef\float@count\count@%
+       \expandafter\e@alloc@chardef\csname bx@\the\float@count\endcsname\float@count%
+       \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
+       \expandafter%
+       \extrafloats\expandafter{\numexpr#1-1\relax}%
+     \fi%
+   }%
   }{% etex package not loaded
-    \gdef\morefloats@efa{1}%
    }%
-\fi%
-\gdef\morefloats@test{1}%
-\ifx\morefloats@efa\morefloats@test\relax%
   \extrafloats{\morefloats@morefloats}%
   % The part after the test is no longer needed and therefore not loaded:
   \expandafter\endinput%
 \fi%
 %% End of the test for LaTeX 2015 (or newer).
+%% Not new format, otherwise the last \endinput would have been applied.
 
+%% Test for e-TeX:
 \RequirePackage{ifetex}[2011/12/15]% v1.2
 \ifetex%
-  %% then we can use the code of David Carlisle:
+  %% then we can use code similar to the one from David Carlisle,
   %% https://tex.stackexchange.com/a/212483/6865
   \mathchardef\float@count=32767\relax%
-  \def\dc@extrafloats#1{%
-    \ifnum#1>\z@%
+  \gdef\extrafloats#1{%
+    \ifnum#1>\z@\relax%
       \count@\numexpr\float@count-1\relax%
+      \ch@ck0\count@\count\relax%
+      \ch@ck1\count@\dimen\relax%
+      \ch@ck2\count@\skip\relax%
+      \ch@ck4\count@\box\relax%
       \mathchardef\float@count\count@\relax%
       \expandafter\mathchardef\csname bx@\the\float@count\endcsname\float@count%
       \@cons\@freelist{\csname bx@\the\float@count\endcsname}%
       \expandafter%
-      \dc@extrafloats\expandafter{\numexpr#1-1\relax}%
+      \extrafloats\expandafter{\numexpr#1-1\relax}%
     \fi}%
-  \dc@extrafloats{\morefloats@morefloats}%
+  \extrafloats{\morefloats@morefloats}%
   \expandafter\endinput%
 \fi%
+%% End of the test for e-TeX.
+%% Old format and not e-TeX,
+%% otherwise the last \endinput would have been applied.
 
-%% Not eTeX, otherwise the last \endinput would have been applied.
 \PackageWarning{morefloats}{%
   e-TeX is not available here\MessageBreak%
   but it is available in almost all\MessageBreak%
@@ -239,19 +267,19 @@
 \ifnum \count12>\@tempcnta \@tempcnta=\the\count12 \relax \def\maxfloats@vln{skip}  \fi%
 \ifnum \count14>\@tempcnta \@tempcnta=\the\count14 \relax \def\maxfloats@vln{box}   \fi%
 %% end similar
-
 \@tempcntb=234\relax%
 \advance\@tempcntb by -\@tempcnta\relax%
 \@tempcnta=\@tempcntb\relax%
-\advance\@tempcntb by +18% already reserved by default
 \ifnum\morefloats@mx>\@tempcntb\relax%
   \PackageError{morefloats}{Too many floats requested}{%
     Maximum number of possible floats asked for: \morefloats@mx .\MessageBreak%
     There are only \the\@tempcnta\space \maxfloats@vln\space left,\MessageBreak%
     therefore only \the\@tempcntb\space floats will be possible.\MessageBreak%
-    Reduce the number of used \maxfloats@vln\space to have more floats available!\MessageBreak%
+    Load the morefloats package earlier and/or\MessageBreak%
+    reduce the number of used \maxfloats@vln\space registers\MessageBreak%
+    to have more floats available!\MessageBreak%
    }%
-  \gdef\morefloats@mx{\the\@tempcntb}%
+  \xdef\morefloats@mx{\the\@tempcntb}%
 \fi%
 
 \global\long\def\@freelist{\@elt\bx@A\@elt\bx@B\@elt\bx@C\@elt\bx@D\@elt\bx@E\@elt\bx@F\@elt\bx@G\@elt\bx@H\@elt%
@@ -496,30 +524,17 @@
 \ifnum \morefloats@mx>254 \newinsert\bx@IU \expandafter\gdef\expandafter\@freelist\expandafter{\@freelist \@elt\bx@IU}
 \ifnum \morefloats@mx>255 \newinsert\bx@IV \expandafter\gdef\expandafter\@freelist\expandafter{\@freelist \@elt\bx@IV}
 \ifnum \morefloats@mx>256\relax%
-  \ifx\e@alloc\@undefined\relax% old LaTeX format
-    \PackageError{morefloats}{Too many floats called for}{%
-      You requested more than 256 floats.\MessageBreak%
-      (\morefloats@mx\space to be precise.)\MessageBreak%
-      LaTeX before 2015 could not process\MessageBreak%
-      more than 256 floats, therefore the morefloats\MessageBreak%
-      package only provides 256 floats.\MessageBreak%
-      If you need more floats,\MessageBreak%
-      update to a current (>=2015) LaTeX distribution.\MessageBreak%
-      I expected LaTeX (prior 2015) to run out of dimensions\MessageBreak%
-      or memory long before reaching this anyway.\MessageBreak%
-      }%
-  \else% new LaTeX format, therefore we are here
-       % because an outdated version of the etex package was used
-    \PackageError{morefloats}{Too many floats called for}{%
-      You requested more than 256 floats.\MessageBreak%
-      (\morefloats@mx\space to be precise.)\MessageBreak%
-      LaTeX can process more than 256 floats since 2015,\MessageBreak%
-      but not if an outdated version of the etex package\MessageBreak%
-      was loaded before the morefloats package.\MessageBreak%
-      Therefore the morefloats package only provides\MessageBreak%
-      256 floats now. If you need more floats,\MessageBreak%
-      update your etex package to the recent version!\MessageBreak%
-     }%
+  \PackageError{morefloats}{Too many floats called for}{%
+    You requested more than 256 floats.\MessageBreak%
+    (\morefloats@mx\space to be precise.)\MessageBreak%
+    LaTeX before 2015 could not process\MessageBreak%
+    more than 256 floats, therefore the morefloats\MessageBreak%
+    package only provides 256 floats.\MessageBreak%
+    If you need more floats,\MessageBreak%
+    update to a current (>=2015) LaTeX distribution.\MessageBreak%
+    I expected LaTeX (prior 2015) to run out of dimensions\MessageBreak%
+    or memory long before reaching 256 floats anyway.\MessageBreak%
+   }%
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
@@ -533,7 +548,7 @@
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi
-\fi \fi \fi \fi \fi \fi
+\fi \fi \fi \fi \fi
 
 \endinput
 %%
-- 
cgit v1.2.3

