108

I have this error message:

! No room for a new \dimen . \ch@ck ...\else \errmessage {No room for
a new #3}
                                                \fi

which I can not find a cure for.

Martin Scharrer
  • 262,582
Zbigniew
  • 2,292
  • 4
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. You seem to use too many package which need to many dimension registers. – Martin Scharrer Dec 17 '11 at 14:13
  • 6
    Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). Please consider also to upvote all helpful answers (including the accepted one -- upvoting has to be done separately from acccepting). – lockstep Jan 07 '12 at 10:35
  • 1
    @MartinScharrer, FYI, I get this error when I try to use beamer, subfig and standalone together. As in \documentclass{beamer}\usepackage{standalone}\usepackage{subfig}... (and, yes, the first answer solves the problem). – alfC Mar 17 '14 at 06:43

2 Answers2

161

This can depend on two reasons:

  1. too many packages;
  2. a programming error, such as saying \newdimen inside the definition of a command.

In case 1, load

\usepackage{etex}

just after the \documentclass line. In case 2, correct the definition.

If you're loading morefloats or manyfoot, then add

\reserveinserts{28}

just after loading etex; this is necessary to accomplish with the needs of those packages.

Note

This trick has to do with the allocation mechanism of insertion classes, that use "high" numbered registers; for example the insertion class \@mpfootnotes uses the registers with number 254 and the last allocated one uses 234. An insertion class reserves the registers of type \count, \dimen, \skip, \box and, of course, \insert with the assigned number. Conversely, commands such as \newcounter or \newlength start from 11 upwards.

When the last allocated counter or length corresponds to number 233, the next request would result (with ordinary LaTeX) in the No room message. By loading etex, in this case the system will allocate instead the first free register in the extended pool, that is, from 256 to 32767.

The packages morefloats and manyfoot allocate 18 and 10 insertion classes; but, depending on the loading order, this could cause clashes; say that packages loaded before them allocate \count registers up to 220: there will be no room for the new insertion classes.

The command \reserveinserts{28} fools the allocation mechanism by pretending that registers from 206 to 233 are already occupied, so a request for a new register, when the last allocated one was 217, will go directly to the extended pool. In this way, morefloats and manyfoot can do their allocations safely, by occupying slots that are surely free, independently on the package loading order (the allocation commands are conveniently patched so as to not interfere with the process of insertion class allocation).

As Stephen remarks in a comment, if morefloats is loaded with more than 18 additional floats (which is the default), then the argument to \reserveinserts should be modified accordingly. Just add 10 to the number of floats for morefloats in case you also use manyfoot.

Update for LaTeX released in 2015

With the release of LaTeX dated January 1, 2015, the extended allocation mechanism has been incorporated in the kernel, so loading etex is not needed any more, provided an engine supporting e-TeX extension is used, which should be the case for TeX distributions released in the last ten years.

Note that older engines that don't support such extensions wouldn't have accepted loading etex anyway.

Also loading morefloats is not needed any more, because the new kernel provides the command \extrafloats that overcomes the need to issue \reserveinserts. For allocating more than the default 18 boxes in the float queues, use \extrafloats{20} (or whatever number you need).

Other features of the etex package (local allocations of registers) are now provided by the elocalloc package.

egreg
  • 1,121,712
  • "If you're loading morefloats or manyfoot, then add \reserveinserts{28} just after loading etex; this is necessary to accomplish with the needs of those packages." Could you please explain the reason for this? (I'm just curious and would like to understand it.) – Stephen Dec 17 '11 at 19:04
  • 1
    @Stephen See edit – egreg Dec 17 '11 at 20:56
  • 1
    Ah, thank you very much! (If I had not given +1 to your answer already, I would have added it now.) – Stephen Dec 18 '11 at 18:38
  • http://ctan.org/pkg/morefloats by default allocates 18 additional registers. If another value is chosen by the user, of course another \reserveinserts{...} must be used as well. – Stephen Jan 07 '12 at 10:23
  • 1
    Sorry, but your answer promotes low quality questions. The question is obviously a FAQ and lacks a MWE. Instead of pointing that out (and downvoting the question) you waist time crafting an elaborate answer. – Martin Schröder Jan 07 '12 at 11:40
  • 11
    @MartinSchröder: I don't see how this answer promotes low quality questions. From personal experience, coming up with a MWE for these kinds of error messages is not an easy task, unless you already know the cause. And then the MWE is just illustrating the limitations so not really any more helpful. – Peter Grill Mar 11 '14 at 18:02
  • 2
    This happens to me just now AFTER UPDATING my tex though the file was compiling with earlier versions. Weird! I have added etex option, and it solved! thanks @ egreg – Khaaba Jun 18 '14 at 08:44
  • 1
    @Khaaba Maybe a package you load has been updated and now it allocates more registers than before; an obvious suspect is PGF/TikZ that in its version 3 has been very largely modified. – egreg Jun 18 '14 at 08:46
  • Very useful, I couldn't create a pdf document and now it run perfect! – MaríaCC Jan 04 '15 at 18:59
  • 1
    \usepackage{etex} fixed problem immediately. – warship Mar 16 '15 at 05:24
  • 4
    Funny – only in LaTeX could you fix an error stemming from too many packages by adding another package. :) – Sean Allred Jul 13 '15 at 01:58
18

This is a FAQ, which is answered at https://texfaq.org/FAQ-noroom

David Carlisle
  • 757,742
  • 28
    No added value to this web link? What if the link is broken down the line? – Werner Dec 17 '11 at 16:02
  • @Werner: People should read the FAQ. – Martin Schröder Jan 07 '12 at 11:35
  • 15
    @MartinSchröder: My comment implies that if the link is broken, this post is of zero value for users who arrive at this point. If there is at least an abridged form of the FAQ answer, users could be helped immediately, and following the link to expand on the answer. – Werner Jan 07 '12 at 16:17
  • 5
    @Werner: The possibility that links to the official TeX FAQ will brake is extremly small. – Martin Schröder Jan 07 '12 at 18:04
  • 23
    @MartinSchröder: Nonetheless, it's considered bad style on here to post a link or some code without any explanation or summary. In Quality Standards for Answers, it says "Hosted in the site – the solution should be entered in the text of the answer itself. Attributions to external sources are fine – and encouraged! – but just linking to solutions posted elsewhere outside of the site should be discouraged." – doncherry Jan 15 '12 at 15:31
  • @doncherry: So we want to copy the FAQ to tex.sx? – Martin Schröder Jan 15 '12 at 15:53
  • 4
    @MartinSchröder: Nope. More something like a summary or an extract of articles relevant for certain questions here. – doncherry Jan 15 '12 at 16:00
  • 3
    @doncherry: it is an extremely disregard of the work of the FAQ maintainer to copy and paste their work ... –  Jan 15 '12 at 17:51
  • 14
    @Herbert: It's common practice to quote relevant bits from work others have done and attribute them properly. I didn't ask for unattributed copies of entire articles. In the end, it will make the FAQ even more well-known and users here will learn to use them as a resource and value that work highly. I have in mind something like "Do \foo{bar} to make this work, add \baz to make it orange. Blue won't work. To find out why not and how this all works, check out the FAQ article, where I got this solution from." – doncherry Jan 15 '12 at 18:11
  • 2
    @doncherry: It will be well-known if you visit that site ... –  Jan 15 '12 at 18:35
  • Thank you very much. I'd also this problem.Used your instructions it's resolved – Looba Jacks May 20 '23 at 14:15