z·eeki·sh

tech log on gentoo, linux, and random stuff

TeX capacity exceeded

leave a comment »

After the discovery of gnuplot’s tikz term, I have been using it for most of the plots I send to my advisor. A very nagging problem though is that when the number of data points is big, pdflatex would complain about “TeX capacity exceeded, sorry [main memory size = xxxx]” and refuse to compile. Today it has just come to a point I can’t stand this any more, so I did some googling and found a solution. Now TeX is a very messy system with fmt, sty, cnf files all over the place, so be sure to backup anything you touch in case something goes wrong.

Here’s a web page from JadeTeX that pointed me in the right direction, http://jadetex.sourceforge.net/#index-div-d18e113. The following solution is based on this.

  1. make changes to texmf.cnf. You may want to use `locate texmf.cnf’ to find where it is. Then in it, change `main_memory’ from 3000000 to say 8000000
  2. now regenerate latex.fmt for plain latex, or pdflatex.fmt for pdflatex. E.g., to recompile pdflatex.fmt:
    1. find where “pdflatex.ini” is
    2. cd to that path, then invoke “pdflatex -ini -progname=pdflatex pdflatex.ini”
      Notice that this is different from what’s in the JadeTeX webpage. You need to invoke “pdflatex” instead of “tex”
    3. now find where the original “pdflatex.fmt” is, back it up, and copy the generated “pdflatex.fmt” to there
  3. to regenerate “latex.fmt”, use “latex -ini -progname=latex latex.ini

Update@2011/06/08:

In gentoo, the proper way of fixing this once and for all is:

  1. Change the value of the corresponding field in file /etc/texmf/texmf.d/20sizes.cnf. This should persist through all future texliveupgrades.
  2. run texmf-update to regenerate the system-wide texmf.cnf
  3. run fmtutil-sys --all to regenerate the .fmt files

Update@2012/3/15:

alternatively one can compile with lualatex, which doesn’t seem to have a size limit

Advertisements

Written by zsh

February 23, 2011 at 2:37 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: