[XeTeX] metapost graphics in xelatex with Persian labels only needs one run of xelatex

Vafa Khalighi vafakhlgh at gmail.com
Tue Mar 1 02:42:29 CET 2011

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:

1- mpdisplay

2- mpinline

3- ltxpreamble

4- mpdefs

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.

you can put your LaTeX definitions or packages (those packages that you want
to use in your metapost figure) inside ltxpreamble environment.

You can put your metapost definitions and inputs (those appearing before
beginfig(n)) inside mpdefs envirnment.

An Example is attached.

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.

*Muḥammad ibn Mūsā al-Khwārizmī*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20110301/82b50223/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-mpgraphics.pdf
Type: application/pdf
Size: 19924 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20110301/82b50223/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-mpgraphics.tex
Type: application/x-tex
Size: 1719 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20110301/82b50223/attachment-0001.tex>

More information about the XeTeX mailing list