# LaTeX capacity exceeded [duplicate]

Possible Duplicate:
How to expand TeX’s “main memory size”? (pgfplots memory overload)

I'm trying to compile a huge LaTeX file with many graphs in it. Those graphs are external files, formatted for PGFPlots. Although many of them compile fine, for some with a lot of data (30000+ lines) it gives me the following error:

``````TeX capacity exceeded, sorry [buffer size=200000].
``````

Now, I'm on a machine with 16GB of RAM, so in theory there should be no problem in compiling those files. Is there a way to increase the size of the memory used by LaTeX and compile these files?

• I tried that before asking, and it doesn't work. Also, increasing the memory too much leads to an error when compiling.
– Masiar
Nov 23, 2012 at 10:23
• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. Nov 27, 2012 at 13:23
• The variable `buf_size` to which the message refers is the maximum length of a line that can be read in by the TeX programs. Isn't it possible to shorten the record lengths in those files? A problem may be in the fact that a `{` is open at the beginning and the matching `}` is at the end, depending on how you input the file. Nov 27, 2012 at 13:34

Consider using `lualatex` for the externalized images. It allocates more memory automatically.

``````\tikzset{external/system call={lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
``````

after the `tikzexternalize` command in the header worked for me, but I am not sure if I miss some other command now.

• does the code use lualatex only and only for ezternalization of the tikz images?
– Ali
Nov 10, 2013 at 1:43
• @Ali It uses whatever program (e.g. `pdflatex`) you use for the document and `lualatex` for tikz pictures.
– Tim
Nov 10, 2013 at 12:59
• What i meant is, can you pdlatex whole document but at the same time luatex external tikz file with this code?
– Ali
Nov 12, 2013 at 14:52
• @Ali My answer should mean that you can do exactly this. Note that this is only the command needed to make `tikzexternal` use `lualatex` instead of e.g. `pdflatex`. Setting up tikzexternal must be done beforehand (and is best tested with your standard LaTeX compiler).
– Tim
Nov 12, 2013 at 15:39
• Have you confirmed that this is fully compatible with references into and out of the externalized figure? Nov 9, 2015 at 13:00