# 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?

-

## migrated from stackoverflow.comNov 27 '12 at 13:12

This question came from our site for professional and enthusiast programmers.

## marked as duplicate by Jake, lockstep, Stefan Kottwitz♦Nov 27 '12 at 14:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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 '12 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. – egreg Nov 27 '12 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. – egreg Nov 27 '12 at 13:34

## 1 Answer

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

Adding

\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 '13 at 1:43
@Ali It uses whatever program (e.g. pdflatex) you use for the document and lualatex for tikz pictures. – Tim Nov 10 '13 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 '13 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 '13 at 15:39
Have you confirmed that this is fully compatible with references into and out of the externalized figure? – Raphael Nov 9 '15 at 13:00