# Can the extended register pool be used for \newinsert?

After reading egreg's answer to No room for a new \dimen I got this question:

The etex package switches to the extended register pool, when the normal one for a register type is exhausted.

For a `\newinsert` one `\count`, `\dimen`, `\skip`, and `\box` each are needed, and they should have the same "number".

`\reserveinserts{...}` can reserve some inserts and force the use of `\count`, `\dimen`, `\skip`, and `\box` registers into the extended register pool.

Is it possible to redefine `\newinsert` to use `\count`, `\dimen`, `\skip`, and `\box` registers from the extended register pool? (And: why not or how?) This would increase the number of possible inserts (whether by morefloats, bigfoot/manyfoot, or manually) by a factor (!) of about 100 (starting `\et@xins` at 32768 and allocating insertions 32767, 32766,...).

-
Note that LaTeX floats don't use TeX inserts. LaTeX uses inserts only for footnotes and `\enlargethispage`, so you can always take the necessary allocations from the extended pool no matter what `\insert` accepts. See latex-community.org/forum/viewtopic.php?f=5&t=3049 for an example. – Philipp Jan 7 '12 at 20:53

## 1 Answer

The answer is a qualified 'no', not because of macro limitations (which could be addressed) but because even with newer engines the maximum `\insert` number remains at 255, at least for pdfTeX and XeTeX. Thus if you try

``````\insert256{}
``````

with one of these engines you will get the error

``````! Bad register code (256).
<to be read again>
{
l.1 \insert256{
``````

The e-TeX manual specifically says that insertion classes are not extended by e-TeX, and so this is defined behaviour.

The situation with LuaTeX seems to be different: this does not give an error with a higher insert number. The LuaTeX documentation explains that registers are extended to 16-bit numbers, and lists those affected, but does not mention `\insert` in this list. So with LuaTeX it may be possible to go beyond register 255, but this is currently not documented. To allow LuaTeX to access the higher register numbers for inserts, all that is needed is to alter the value of `\et@xins` after loading `etex.sty`, something like

``````\csname et@xins\endcsname=65535 %
``````

will start at the highest possible register number and work downward.

-
I am checking on the LuaTeX situation: update once I have it! – Joseph Wright Jan 7 '12 at 20:15
Wow! The "no" is a pity, but the "because" is a good explanation and the LuaTeX a bonus. +1 and accepted! – Stephen Jan 8 '12 at 18:14