[texhax] TeX capacity exceeded??

Reinhard Kotucha reinhard.kotucha at web.de
Sat Feb 18 21:04:11 CET 2006

>>>>> "조영탁" == 조영탁  <tak at gwangju.ac.kr> writes:

  > Hi there.  Please take a look at my question to the WinEdt office
  > attached below.  I just wish that you can help me out with this
  > embarrassing problem.  Thanks very much in advance.  Ciao.

Hi Tak,
thank you for sending me the relevant files.  They are very helpful.

If you look into the log file you'll see:

  ! TeX capacity exceeded, sorry [main memory size=2000001].
  \put ... \hb at xt@ \z@ {\kern #1\unitlength #3\hss }
  l.45153 \put(909,308){\rule{1pt}{1pt}}

That means that the error occurs in line 45153 of the included file.

This file is extremely large, hence I'm not surprised that tex complains.

There is a bug in the program which created this file (gnuplot).
There are many duplicate lines, for instance:


When I remove all duplicates there will be "only" 18238 lines instead
of 49473.

Maybe it's best if you send a bug report to the gnuplot developers.
It should be sufficient to send them the first 20 lines of the file
you sent to me.

It seems that the file is so large because it contains dotted lines.
With duplicates removed, the beginning of the files looks like this:


This is a horizontal dotted line (60 dots) and you would save a lot of
memory by using solid lines instead.

Misusing tex for drawing graphs was a nice thing at a time people used
emTeX under DOS which did not support PostScript or PDF.  I remember
that tex spent many minutes to process such a file and often gave up
with the message "capacity exceeded" at the end.  At this time (more
than a decade ago) there had been no alternative (at least under DOS).   

However, as of gnuplot version 4.0 there is a new terminal "epslatex".
It is described on page 109 of the manual.  I assume that this will
never exceed tex's memory.

Gnuplot also has a metapost driver (page 120).  I used this some time
ago.  You can try this as well.  The advantage is that it is quite
easy to tweak the resulting .mp file a little bit, for instance
replace "1e-5" by "$10^{-5}$" if desired, but be aware that the
changes are lost when you run gnuplot again unless you write a little
program which does the modification.

If you want really high quality graphs, please look at

   http://pyx.sf.net .

PyX is much more powerful than gnuplot and is designed especially to
create graphics which are to be included in tex documents.  It is very
extensible.  It requires that you are familiar (at least a little bit)
with the Python programming language, though.

There is a tutorial which describes PyX for Gnuplot users:


Though tex's memory can be increased, I recommend to try the epslatex
or the mp terminal or PyX before.

WinEdt is just a user interface, I suppose that the real work is done
by MikTeX.  If you really need a tex with more memory I fear that
there is no way to avoid reading the MikTeX manual.


Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the texhax mailing list