LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Thu, 16 Sep 2010 15:44:40 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Message-ID:
Subject:
MIME-Version:
1.0 1.0
Content-Transfer-Encoding:
8bit
In-Reply-To:
Content-Type:
text/plain; charset=ISO-8859-1
From:
Chris Rowley <[log in to unmask]>
Parts/Attachments:
text/plain (69 lines)
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)

ATOM RSS1 RSS2