# [luatex] Metapost capacity exceeded

Jean J2N-FORGET at orange.fr
Tue May 29 07:23:19 CEST 2012

I wrote a lualatex file with some Metapost figures in it and I had the
message "Metapost capacity exceeded". So I have tried an experiment. I
wanted to have Metapost figures known to be correct and of a
reasonable complexity, so they had to compile right. If there was an
error, it would be the compiler's fault, not the file's.

So I started with the mpman.mp file for John Hobby's "A Metapost
Manual". I checked that it compiles with /usr/bin/mpost installed from
TeXlive.

I split mpman.mp into separate figures and I wrapped each figure with
the following minimalistic lualatex file:

--- copy-paste begins
\documentclass[a4paper]{article}
\usepackage[utf8]{luainputenc}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
>>>> insert here the source code for one figure
\end{mplibcode}
\end{document}
--- copy-paste ends

Then, I compiled each file with lualatex separately. Most files
compiled and gave proper PDF files, but there were a significant
number of errors. Notably, the figures #40 and #55 fail with the
same error message:

--- copy-paste begins
! MetaPost capacity exceeded, sorry [main memory size=5000].
--- copy-paste ends

Where does this "5000" value come from? Can we change it in a config
file or in a command-line parameter?

Note: I have googled (*) the error message, which gave me old posts,
applying to TeXLive-2007 or MikTeX, but not lualatex.

(*) Or rather, I have duckduckgo'ed it.

My version of lualatex is the one installed with Ubuntu 10.4 Lucid Lynx:
--- copy-paste begins
This is LuaTeX, Version beta-0.50.0-2010010505
--- copy-paste ends

------------------------------------------------------------------------
Second part of the experiment:

--- copy-paste begins
This is LuaTeX, Version beta-0.70.1-2011051918 (rev 4277)
--- copy-paste ends

When I compile figure 1 or any other with this version, I do not get
any PDF file.  Standard output contains:
--- copy-paste begins
This is LuaTeX, Version beta-0.70.1-2011051918 (rev 4277)

(Fatal format file error; I'm stymied)
--- copy-paste ends
to copy-paste here.

I need to initialise some other files too: texmf.cnf and lualatex.fmt
according to the standard error file. I did not find any explanations
http://wiki.luatex.org/index.php/Main_Page.

So my question would rather be: how can I install a lualatex version
into a sandbox, without trashing the version installed in /usr/bin?

------------------------------------------------------------------------
By the way, coming back to the first part of the experiment, when
compiling the figures from mpman.mp with the older version of
lualatex, I have some errors other than "metapost capacity
exceeded". In figures 0, 123, 18, 19, 20, 223, 22, 24, 26, 29, 30, 35,
36 and 37, the error is:

--- copy-paste begins
! LuaTeX
error ...share/texmf-texlive/tex/luatex/luamplib/luamplib.lua:74: inva
lid option '%C' to 'format'
stack traceback:
[C]: in function 'format'
...share/texmf-texlive/tex/luatex/luamplib/luamplib.lua:74: in function
'log'
...share/texmf-texlive/tex/luatex/luamplib/luamplib.lua:143: in
function 'repo
rt'
...share/texmf-texlive/tex/luatex/luamplib/luamplib.lua:173: in
function 'proc
ess'
...share/texmf-texlive/tex/luatex/luamplib/luamplib.lua:101: in
function 'proc
esslines'
<\directlua >:1: in main chunk.
--- copy-paste begins

And in figures 14, 42 and 45, there are various other errors.