{"id":4824,"date":"2014-03-30T15:37:54","date_gmt":"2014-03-30T15:37:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-prevent-latex-memory-overflow-collection-of-common-programming-errors\/"},"modified":"2014-03-30T15:37:54","modified_gmt":"2014-03-30T15:37:54","slug":"how-to-prevent-latex-memory-overflow-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-prevent-latex-memory-overflow-collection-of-common-programming-errors\/","title":{"rendered":"How to prevent latex memory overflow-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;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&#8217;m &#8220;filling&#8221; the area by drawing a plenty of bezier curves inside it&#8230;<\/p>\n<p>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:<\/p>\n<pre><code>! TeX capacity exceeded, sorry [main memory size=3000000].\n<\/code><\/pre>\n<p>How can I prevent this error ? (by freeing memory after macro or such&#8230;) Or even better how do I fill the area determined by two quadratic bezier curves?<\/p>\n<p>Code that produces error:<\/p>\n<pre><code>\\usepackage{forloop}\n\\usepackage{picture}\n\\usepackage{eepic}\n...\n\\linethickness{\\lineThickness\\unitlength}%\n\\forloop[\\lineThickness]{cy}{\\cymin}{\\value{cy} &lt; \\cymax}{%\n  \\qbezier(\\ax, \\ay)(\\cx, \\value{cy})(\\bx, \\by)%\n}%\n<\/code><\/pre>\n<p>Here are some example values for variables:<\/p>\n<pre><code>\\setlength{\\unitlength}{0.01pt}\n\\lineThickness=20\n%cy is just a counter - inital value is not important\n\\cymin=450 \\cymax=900\n%from following only the difference between \\ax and \\bx is important\n\\ax=0 \\ay=0 \\bx=550 \\by=0\n<\/code><\/pre>\n<p><em>Note: To reproduce the error this code have to execute approximately 150 times (could be more depending on your latex memory settings).<\/em><\/p>\n<p>Thanks a lot for any help<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;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&#8217;m &#8220;filling&#8221; the area by drawing a plenty of bezier curves inside it&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4824","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4824"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4824\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}