This article originally appeared on http://olezfdtd.wordpress.com I’ve copied it over to my current blog to consolidate all my blogging efforts over the years in one place.
Latex is a very powerful typesetting application. A powerful package to be used with this is pgfplots, which allows you to render your plots using the latex engine. Unfortunately the default latex settings assume you’re running latex on an ancient 20 MHz 486 with less ram than your average mobile phone. This is ok if you’re just asking it to process text, but if you’re using pgfplots it will run out of memory trying to draw your images.
The solution is to increase the amount of memory latex uses.
Windows - Miktex
We’re doing this in the windows command line. You can get to this by opening the start menu and do run ...
. Type cmd
to start the terminal. On vista and up, you can just type cmd
in the search field.
Go the folder where Miktex is installed. Most likely this is
C:\Program Files\Miktex 2.7\
Go to the subfolder
Miktex
Go to the subfolder
bin
run
initexmf --edit-config-file=pdflatex
Replace
pdflatex
withlatex
orxetex
if you’re using that.You’ll get a notepad screen with a file called
pdflatex.ini
. Add the linemain_memory=2000000
Don’t worry about the exact number, just make it big.
Save the file
run
initexmf --dump=pdflatex
That’s it. Enjoy your nice pgfplots figures
Linux - Texlive
Do the following things in a terminal as root.
Find out where your
texmf.cnf
is locatedkpsewhich texmf.cnf
This will most likely be
/usr/share/texmf/web2c/texmf.cnf
Open it and search for main_memory line and modify it to
main_memory=2000000
Save the file
run
fmtutil-sys --all
to load the new settings