Hi Heiko

> Thanks for this, Heiko.  Note there is no upper range check in the code
> for \reserveinserts.

>> AFAIK there is no need:

No, not _essential_ to do anything their but then:


  \newinsert\foobar

at a seemingly random time later will give this error:

  ! No room for a new \dimen.

which does not immediately make one think about the most recent use of \reserveinserts (or show you where that is!).

Thus to help with 'debugging weird errors' it might be useful if \reserveinserts at least put a warning into the log file: especially for those who have forgotten that eTeX still limits the number of insert classes and gives an error about \dimen when you have too many \newinsert commands.

Thus, this I like:

>>
\RequirePackage{etex}
\makeatletter

\outer\def \reserveinserts#1{%
  \begingroup
    \@tempcnta=\numexpr#1\relax
    \ifnum\@tempcnta<\z@
      \PackageWarning{etex}{%
        Negative number (\the\@tempcnta) for %
        \@backslashchar reserveinserts,\MessageBreak
        assuming 0%
      }%
      \@tempcnta=\z@
    \fi
    \count@\count10 % count
    \ifnum\count11>\count@ \count@\count11 \fi % dimen
    \ifnum\count12>\count@ \count@\count12 \fi % skip
    \ifnum\count14>\count@ \count@\count14 \fi % box
    \count@=\numexpr\et@xins-\count@\relax
    \PackageInfo{etex}{%
      Maximum for \@backslashchar reserveinserts is \the\count@
    }%
    \ifnum\@tempcnta>\count@
      \PackageError{etex}{%
        \the\@tempcnta\space insertion register%
        \ifnum\@tempcnta=\@ne \space is \else s are \fi
        requested,\MessageBreak
        \ifnum\count@<\@ne
          but no more registers can be reserved%
        \else
          but only \the\count@\space register%
          \ifnum\count@=\@ne\else s\fi\space can be reserved%
        \fi
      }\@ehc
      \@tempcnta=\count@
    \fi
    \global\insc@unt\numexpr\et@xins-\@tempcnta\relax
  \endgroup
}
>>

Cheers, chris

---------------------------------------------------------------------------
The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302)