TeX capacity exceeded, sorry [buffer size=20000

There are questions about memory exhaustion when building docs with tikz plots in it. I could not find a solution, though.

Downsampling is not an option as the figure is already highly downsampled. It's a 3d plot with lots of lines. There is an answer about increasing mem size and externalization but how to do that on writeLatex? I found this answer about passing command line options:

yes - you can set command options by creating a custom latexmkrc file in a project, with $pdflatex = 'pdflatex --shell-escape';

So I tried to enable externalization by creating a file with the given single line in the main directory. But how would I name the file latexmkrc or what extension would it have? Maybe it's .latexmkrc but this is not an allowed file extension. Is this a limitation of free accounts (I only have a free one)?

  • Did anybody solved this issue already?
  • How to name the file correctly?
  • Any other way to build dense plots on writeLatex?
  • 1
    buffer size is essentially the line length (after macro expansion) in the source file, so the format of the source is as important as its overall size (but tikz token handling may end up with creating long buffers anyway I guess, I don't know tikz internals at all) but if you have such large jobs why not run latex locally where you can set these limits in texmf.cnf Commented Dec 3, 2014 at 20:38
  • You should be able to create a file called latexmkrc (without extension) --- it's a special file name that writeLaTeX allows for this purpose. Does that help? Commented Dec 3, 2014 at 23:12
  • @jdleesmiller yep, that works indeed.
    – embert
    Commented Dec 4, 2014 at 9:16
  • OK great. I've just added that as an answer. Commented Dec 4, 2014 at 10:45

2 Answers 2


You can create a file called latexmkrc (no extension) --- it's a special file name that writeLaTeX allows for this purpose.

  • There is no explicit hint on whats the compile time out limit for a pro account, but I guess it's significantly higher, is it?
    – embert
    Commented Dec 4, 2014 at 13:08

Okay, in the end, reducing the original plot complexity is apparently the only option and brought me from exceedance of the memory to exceedance of compile time.

  1. The reduced data plot with 80k datapoints compiled on a local machine in ~36s (using LuaLaTeX) enter image description here

  2. After further reduction of datapoints, I found the limit for compilation on writeLaTeX at about 10k datapoints with pdfLaTeX (LuaLaTeX runs out of time again). So the limitation is rather by compile time. enter image description here

Non-free accounts apparently allow longer durations.

Fair Use Limits
If you have a very large document, it may just take a long time to compile. If you sign up for a free account, and you are signed in when you are editing your documents, we will give your documents more time to compile than if you are not signed in. If this is still not enough, we offer even longer compile times on our paid plans. We have to set timeouts in order to deal with infinite loops, and also to ensure that we are fair to all of our users. Source

  • Hi embert - if you send us the link to your document via our contact form, we'll increase the timeout for you on that project. Commented Dec 4, 2014 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .