# [texhax] [solved] Re: No room for new \count

Brandon Kuczenski brandon at 301south.net
Sun Aug 22 06:18:11 CEST 2010

On Sat, 21 Aug 2010, Brandon Kuczenski wrote:

> I recently ran into the error "No room for new \count".  I understand that
> TeX only has room for 256 counters, but I don't think I'm using this many. I
> think, instead, that I have some kind of error in my coding, which has gotten
> considerably more complicated in the last few weeks.
>
> I'm using arrayjobx, with many arrays (probably around 20), and a number of
> fancy tricks to index into them.  And I'm using multido, with 2 and sometimes
> 3 levels of nesting.  Plus a couple of custom styles which use counters.  But
> I only declare \newcount 8 times, and they're all at the base level in style
> files (never in macros). So I can't imagine how I could be running out of
> counters.

I lied.  I was using \newcount inside a macro.  I solved the problem with
the following trick:

\let\oldnewcount\newcount
\def\newcount{\typeout{new count!}\oldnewcount}

and then using other \typeouts to triangulate the location of all the
copious counters.  It was in a function I had written awhile ago before I
knew better, in a style file I had forgot I was using.

-Brandon