Friday, October 7, 2011

Tex capacity exceeded, sorry!



Every once in a while, someone in my company that tries to generate our documentation get the following error :

Tex capacity exceeded, sorry [main memory size 1000000].

This message is even accompanied (in the log file with the following message

If you really absolutely need more capacity, you can ask a wizard to enlarge me.

Since I am the de facto "wizard" around, here, people turn to me, and every time, we struggle to fix this problem since not one of us has the same linux installation.

So I decided to make a note on the main ways to solve this problem.
  • Often, this means there is a problem in the LaTeX code, like infinite loop (if you are a guru and use \loop commands), but more often there is a forgotten group somewhere.
  • In our case, we really have a memory problem as the document we generate has 600+ pages, hence we need to increase the main memory size:
    1. Locate texmf.cnf and edit it (as root). (On some distribution, you may prefer to edit files in /etc/texmf/texmf.d)
    2. Search for main_memory and change the size (for instance to 2000000).
    3. You need to recreate the format files of LaTeX depending on your distribution, you may do so by using update-texmf (debian) or fmtutil-sys --all (redhat)
    4. If this does not work (i.e., LaTeX still complains having only 1000000 memory), look in your home directory: you may have an old ~/.texmf-var directory that LaTeX uses first and hence does not care about your system-wide configuration (This mistake cost me hours on more that one occasion!)

No comments:

Post a Comment