How to prevent latex memory overflow
Posted
by drasto
on Stack Overflow
See other posts from Stack Overflow
or by drasto
Published on 2010-04-10T14:41:08Z
Indexed on
2010/04/10
14:43 UTC
Read the original article
Hit count: 544
I've got a latex macro that makes small pictures. In that picture I need to draw area. Borders of that area are quadratic bezier curves and that area is to be filled. I did not know how to do it so currently I'm "filling" the area by drawing a plenty of bezier curves inside it...
This slows down typeseting and when a macro is used multiple times (so tex is drawing really a lot of quadratic bezier curves) it produces following error:
! TeX capacity exceeded, sorry [main memory size=3000000].
How can I prevent this error ? (by freeing memory after macro or such...) Or even better how do I fill the area determined by two quadratic bezier curves?
Code that produces error:
\usepackage{forloop}
\usepackage{picture}
\usepackage{eepic}
...
\linethickness{\lineThickness\unitlength}%
\forloop[\lineThickness]{cy}{\cymin}{\value{cy} < \cymax}{%
\qbezier(\ax, \ay)(\cx, \value{cy})(\bx, \by)%
}%
Here are some example values for variables:
\setlength{\unitlength}{0.01pt}
\lineThickness=20
%cy is just a counter - inital value is not important
\cymin=450 \cymax=900
%from following only the difference between \ax and \bx is important
\ax=0 \ay=0 \bx=550 \by=0
Note: To reproduce the error this code have to execute approximately 150 times (could be more depending on your latex memory settings).
Thanks a lot for any help
© Stack Overflow or respective owner