Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using longtable package (together with xcolor for alternating row colors and booktabs for elegant table headers) to generate a huge table. And by huge, I mean it has more than 900 lines and takes up more than 29 pages. However, I'm getting this error:

TeX capacity exceeded, sorry [main memory size=3000000].

My code is similar to this one:

\newcolumntype{D}{>{\raggedright\arraybackslash}m{54mm}}
% Plus a few other new column types

% Alternating colors starting on 3rd row
\definecolor{tabular-odd-color}{gray}{0.90}
\definecolor{tabular-even-color}{gray}{0.97}
\rowcolors{3}{tabular-odd-color}{tabular-even-color}

\begin{longtable}{DTCNAHHHHHH}

\toprule
col1 & col2 & col3 & col4 & col5 & col6 & col7 & col8 & col9 & col10 & col11 \\
\midrule
\endhead

% LOTS of rows here. I mean, maybe a few thousand, taking up 30, 40 or more pages.

\bottomrule

\end{longtable}

How can I avoid exceeding the TeX capacity?

(by the way, I'm using pdflatex from texlive)

(I've already read this page, but my rows already have blank lines between them, thus that solution does not apply to me.)

share|improve this question

2 Answers 2

up vote 4 down vote accepted

Use luatex it dynamically allocates memory so you are limited by the physical memory available AFAIK (there is no sample file that I can test to tell if it actually works).

share|improve this answer
    
And... how to use LuaTeX? I've never used it, and I have no idea about how it can be used. –  Denilson Sá Sep 24 '10 at 12:28
    
If you are lucky enough, just running lualatex on your document would be all what you need if you are not interested in any of the extra goodies LuaTeX provides. –  Khaled Hosny Sep 24 '10 at 12:50
    
On my Gentoo system, texlive-luatex is not stable yet, and on my Ubuntu server, there is no lualatex executable. I guess I'll wait some more months/years until giving lualatex another try. –  Denilson Sá Oct 1 '10 at 20:12
    
Use TeXLive 2010 from TUG, it would take years before it gets into Ubuntu (and will be severely outdated by then). Dunno about Gentoo, by the time I was using it there packaging had became a mess. –  Khaled Hosny Oct 1 '10 at 21:08
2  
About one year later, I tried lualatex. It took about 1.5GB of RAM to compile a huge 827-page longtable, but it worked! (after messing a bit with the preamble because of incompatibilities with lualatex, see also tex.stackexchange.com/questions/28642/… ) –  Denilson Sá Oct 29 '11 at 4:45

A first possibility is to add the option --extra-mem-top=n to your invocation of pdflatex. Replace n by a number of which you suppose it's big enough.

A more permanent solution is to invoke initexmf --edit-config-file=latex and change the line with main_memory. Afterwards you have to rebuild your format files using initexmf --dump=latex. Perform the same for pdflatex to get all configurations straight.

But these are just workarounds, there could be other problems with your document that lead to exceeded capacity errors. Does your document compile with a subset of the rows? Are you sure all your \newcolumntype's and such are correct?

share|improve this answer
    
Yeah, it compiles when the number of rows is less than 900. I'm not very sure if my columns are correct, but as I said, they DO work when the number of rows is less than 900. –  Denilson Sá Sep 22 '10 at 20:51
1  
Unfortunately, --extra-mem-top and --extra-mem-bot are parameters exclusive for MiKTeX, and I'm using texlive. :-( –  Denilson Sá Sep 22 '10 at 23:21
3  
you can set the extra_mem_top and extra_mem_bot in texmf.cnf. –  Khaled Hosny Sep 24 '10 at 12:53
1  
Your solution is valid, but I'd love to have a solution that would not involve root access, or that at least would not require any extra step configuring the installed packages. Why? Because I don't want things stop working whenever someone updates the system or goes to another machine. –  Denilson Sá Oct 1 '10 at 20:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.