One solution which works quite well is to switch the
LaTeX
executable: if you have a decent
TeX
distribution, you will have the lualatex executable as
well. This, in turn, uses dynamic memory allocation such that it
usually has enough memory for any
pgfplots axis.
The LuaLaTeX
executable lualatex is supposed to be almost compatible
with pdflatex.
If you are running MiKTeX
and you do not want to (or cannot switch) to lualatex,
you can proceed as follows.
For MiKTeX, memory limits can be increased in two ways. The first is to use
command line switches:
Experiment with these settings if MiKTeX
runs out of memory. Usually, one doesn’t invoke
pdflatex manually: there is a development aid which does
all the invocations, so this one needs to be adjusted.
Sometimes it might be better to adjust the MiKTeX
configuration file permanently, for example to avoid reconfiguring
the
TeX
development program. This can be implemented using the command
which can be typed either on a command prompt in Windows or using
Start \(\gg \) Execute. As a result, an editor will be opened with
the correct config file. A sample config file could be
or any of the config file entries which are listed below can be
entered. Thanks to “LeSpocky” for his documentation in
In addition to the option to switch to lualatex, you can
proceed as follows to keep existing dvips or
pdflatex workflows.
For Unix installations, one needs to adjust config files. This can
be done as follows:
1. Locate
texmf.cnf on your system. On my Ubuntu installation,
it is in
/usr/share/texmf/web2c/texmf.cnf.
2. Either change
texmf.cnf directly, or copy it to some convenient
place. If you copy it, here is how to proceed:
• keep only the changed
entries in your local copy to reduce conflicts.
TeX
will always read all config files found in its
search path.
• Adjust the search
path to find your local copy. This can be done using the
environment variable TEXMFCNF. Assuming your
local copy is in ~/texmf/mytexcnf/texmf.cnf, you
can write
to search first in your directory, then in all other system
directories.
3. You should change the entries
The logfile usually contains information about the parameter
which needs to be enlarged.
An example of this config file thing is shown below. It changes
memory limits.
1. Create the file
~/texmf/mytexcnf/texmf.cnf (and possibly the paths as
well).
2. Run texhash such
that
TeX
updates its ~/texmf/ls-R database.
3. Create the environment
variable TEXMFCNF and assign the value
‘~/texmf/mytexcnf:’ (including the
trailing ‘:’!). For my linux system, this
can be done using by adding
to ~/.bashrc.
Unfortunately,
TeX
does not allow arbitrary memory limits, there is an upper bound hard
coded in the executables.