#26 asymptote support xelatex

closed
nobody
None
5
2008-07-25
2008-07-19
Anonymous
No

Native Unicode support of XeTeX is more wonderful for none english user. There are more and more people in Asia country like to use XeTex system. So I hope that asymptote can support xelatex engine.
of course latex can support chinese font with CJK. but the configuration process of CJK font is tedious.

I have done some initial jobs base Asymptote1.43. The attach file is my patch. with this patch, we can use asy -tex xelatex to compile asy source file which contain unicode font etc. chinese.

there is a known issue. after applying my patch. show the following code.

texpreamble("\usepackage{ifxetex}");
texpreamble("\RequireXeTeX");
texpreamble("\usepackage{color}");
texpreamble("\usepackage[dvipdfm]{graphics}");
texpreamble("\usepackage{fontspec}");
texpreamble("\setmainfont{SimSun}");
size(0,3cm);
draw(unitcircle,red);
// the label "C" can use
label("C",(0,0));

assume the name of this file called test.asy, compile this code with asy -k -tex xelatex test.asy. will get test_0.eps which contain a full circle. and test_.tex, which can tex file include the test_0.eps and the label "C". because each file contian negative coordinate. then use xelatex -no-pdf to produce test_.xdv file. then use xdvipdfmx utility to produce test_.pdf file. we will get a cropped circle. because the xdvipdfmx can't handle negative coordinate correctly.
if use latex. in the final step of aysmptote. it will call dvips to transfer dvi file to ps file. and use -O parameter to adjust the corresponding negative coordinate. so i trid to use -x and -y parameter to do same job. but also get a cropped circle. according my debug. In the internally, xdvipdfmx will call gs utility to process test_0.eps file. but gs can't deal with negative coordinate. if pass -DEPSCrop parameter to gs(config in dvipdfmx.cfg file), we will get a full circle. but the position of label may not right. so i think it is a bug of xdvipdfmx. if asymptote not produce negative coordinate is more better.

my E-mail: Addylee2004@163.com

Discussion

  • the patch for asympote-1.43 support xelatex engine

     
    Attachments
  • John Bowman
    John Bowman
    2008-07-25

    Logged In: YES
    user_id=808099
    Originator: NO

    xelatex support has already been added (on 01 Jul 2008) to the latest svn development code.

    Give this a try and let us know if there are any remaining issues.

     
  • John Bowman
    John Bowman
    2008-07-25

    • status: open --> closed