9

Is there a LuaLaTeX equivalent of

\startMPinclusions 
    input mpfile; 
\stopMPincusions

in ConTeXt?

That is, if I have

\documentclass{article} 
\usepackage{luamplib}

\begin{document}
\begin{mplibcode}

Some MP code that requires a reference to another File.mp

\end{mplibcode}
\end{document}

How do I get LuaLaTeX to recognise the other File.mp?

8

I have no problem with

\documentclass{article} 
\usepackage{luamplib}

\begin{document}
foo

\begin{mplibcode}
input demo.mp;
\end{mplibcode}

bar
\end{document}

and a demo.mp with

beginfig(1);
    pair A, B, C;
    A:=(0,0); B:=(1cm,0); C:=(0,1cm);
    draw A--B--C;
\endfig;

enter image description here

| improve this answer | |
  • The code in \startMPinclusions in included in all metapost environments such as \startMPcode, \startMPpage, \startuseMPgraphics, etc. Is that also true for mplibcode? – Aditya Nov 10 '13 at 23:23
  • Unfortunately there isn't any equivalent of \startMPinclusions in luamplib yet. But the new maintainer of luamplib — Kim Dohyun — seems to be very active, so we may hope for it in the future. – Franck Pastor Jan 11 '14 at 17:44
6

Just to mention that luamplib, thanks to Kim Dohyun, has just got an equivalent of \startMPinclusions…\stopMPinclusionsin its latest version (2.3): the commands \everymplib{…}and \everyendmplib{…} (inspired by the everympkey option of Enrico Gregorio's gmppackage).

The command \everymplibadds its content to the beginning of each mplibcodeenvironments, and \everyendmplibacts similarly for the end of those environments. An example:

\documentclass{article}
\usepackage{luamplib}
\everymplib{input mpcolornames; beginfig(1);}
\everyendmplib{endfig;}

\begin{document}
    \begin{mplibcode}
        fill fullcircle scaled 2cm withcolor Pink;
    \end{mplibcode}
\end{document}

A pink-coloured disk

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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