<div dir="ltr">I have written the mpgraphics package as a part of xepersiantools which
allows you to have metapost figures in your final PDF with Persian
labels with only one run of xelatex with -shell-escape option (no
separate run of metapost). Four environments are defined:<br>
<br>1- mpdisplay<br><br>2- mpinline<br><br>3- ltxpreamble<br><br>4- mpdefs<br><br>mpdisplay
places metapost figure in display mode (center) and mpinline places
metapost figure in inline mode (just like inline maths). You put your
metapost codes(code between beginfig(n) and endfig) in mpdisplay or
mpinline environment.<br>
<br>you can put your LaTeX definitions or packages (those packages that
you want to use in your metapost figure) inside ltxpreamble environment.<br><br>You can put your metapost definitions and inputs (those appearing before beginfig(n)) inside mpdefs envirnment.<br>
<br>An Example is attached.<br><br>Suggestions are welcome!<br clear="all"><br>-- <br><div dir="ltr">If some one say: "You divide ten into two parts: multiply the one by
itself; it will be equal to the other taken eighty-one times."
Computation: You say, ten less thing, multiplied by itself, is a hundred
plus a square less twenty things, and this is equal to eighty-one
things. Separate the twenty things from a hundred and a square, and add
them to eighty-one. It will then be a hundred plus a square, which is
equal to a hundred and one roots. Halve the roots; the moiety is fifty
and a half. Multiply this by itself, it is two thousand five hundred and
fifty and a quarter. Subtract from this one hundred; the remainder is
two thousand four hundred and fifty and a quarter. Extract the root from
this; it is forty-nine and a half. Subtract this from the moiety of the
roots, which is fifty and a half. There remains one, and this is one of
the two parts.<br><br><b>Muḥammad ibn Mūsā al-Khwārizmī</b></div><br>
</div>