Skip to content

Can we use metafun format with minim-mp?

I tried to use the metafun format with minim-mp (minim version 1.2 from texlive, if it matters) with no luck.

A minimal (not working) example is:

\input minim-mp
\directmetapost[format='metafun.mp']{
  beginfig(1);
  draw unitcircle scaled 1cm;
  endfig;
}
\bye

With luatex (form texlive 2023) it fails with the following message:

┌ opening metapost instance :metapost: (1)
│ This is MetaPost, Version 2.02  7 MAY 2023 15:51 (/usr/local/texlive/2023/te
xmf-dist/metapost/context/base/commo
│ n/metafun.mp
│ ! I can't open file `metafun.mpii'.
│ l.6     input metafun.mpii

│ Please type another input file name
│ ! Emergency stop.
│ l.6     input metafun.mpii

│ *** (job aborted, file error in nonstop mode)
└ status 3 (fatal)

I'm not a metapost/metafun/ConTeXt expert but I tried to investigate a little. The contents of metafun.mp are the following:

if known metafunversion : endinput ; fi ;

if known mplib :
    input metafun.mpiv
else :
    input metafun.mpii
fi ;

From what I understand, mpiv files correspond to the luatex engine while the older mpii version worked with pdftex. The error puzzles me for two reasons: why the mpii version is chosen and why metapost cannot find the files. Then, I also tried to pass a different option format='metafun.mpiv', but this produces a different error (I can attach the log file if needed).

A similar minimal example works with plain (lua)TeX using luamplib:

\input luamplib.sty
\mplibsetformat{metafun}
\mplibcode
  beginfig(1);
  draw unitcircle scaled 1cm;
  endfig;
\endmplibcode
\bye

My final questions are the following. Am I doing something wrong? Or, is minim-mp not compatible with metafun?

Edited by Luca Donetti