[Tex/LaTex] TeX capacity exceeded (save size)

errorsindexingmemorytex-corexindy

I am generating a fairly large index of .txt, .tex, and .pdf files. This process has worked for a long time, and the size of the index is not the issue. I have added logic to insert additional links in the index and now am running into:

TeX capacity exceeded, sorry [save size=80000]

Questions:

  1. What are the typical causes of this kind of problem, and any suggestions on how to determine the cause of this.
  2. Can the save size be increased?

Of course any solution that just allows me to increase the save size would be preferable if it works, the first question is only important if the size can't be increased or I run into this problem again.

Notes:

  • Generating smaller indices seems to work just fine, only when I attempt to generate the entire index do I run into problems, so coming up with a MWE will be difficult.

Best Answer

You can set the save size in texmf.cnf, eg TL2013 default setup has

save_size  = 100000     % for saving values outside current group

It will be somewhere like

/usr/local/texlive/2013/texmf-dist/web2c/texmf.cnf

see

kpsewhich texmf.cnf

But 99 times out of 100 if you are using a save stack of more than a few hundred, you are repeatedly setting the same token with both local and global assignments and using arbitrarily large save stack. (It is to avoid this problem that plain tex introduces the convention of using odd scratch registers for global assignments and even ones for local)

Related Question