[pstricks] Public beta (alpha?) test of PSTricks support in XeTeX

caapv 208 caapv208 at yahoo.co.jp
Wed Mar 7 15:19:07 CET 2007


Excuse me for cross postings, but I would like to invite
any
adventurous souls to test the new functionality of
preliminary
support of PSTricks macros in XeTeX engine.
The implementation is really simplistic one which analyze
special commands generated by PSTricks related packages
in the dvi driver (xdvipdfmx), recollect all the relevant
bits, and
then delegates real job of renderings to external PS
interpreters.

So here is a brief instruction for the set-up:
* You need a working version of XeTeX compiler installed. 
The version
  in TeXLive 2007 is just fine.
* Unless you have compiled the SVN version of XeTeX
yourself, you have
  to install 3 files
http://scripts.sil.org/svn-public/xetex/TRUNK/texmf/tex/generic/xetex-pstricks/xetex-pstricks.con
http://scripts.sil.org/svn-public/xetex/TRUNK/texmf/tex/xelatex/xetex-pstricks/pstricks.con
http://scripts.sil.org/svn-public/xetex/TRUNK/texmf/tex/xetex/xetex-pstricks/pstricks.con
* You have to check out SVN repository of
http://scripts.sil.org/svn-public/xdvipdfmx/TRUNK/
  and compile the latest version of the dvi driver
yourselves.
  Since eps inclusion code in the driver has been
accidentally
  broken, you can apply this patch in case you are going
to include
  eps figures in your document:
Index: src/spc_dvips.c
===================================================================
--- src/spc_dvips.c	(revision 86)
+++ src/spc_dvips.c	(working copy)
@@ -68,6 +68,13 @@
   char *ps_header, *pro;
 
   skip_white(&args->curptr, args->endptr);
+  if (args->curptr + 1 >= args->endptr ||
+      args->curptr[0] != '=') {
+    spc_warn(spe, "No filename specified for PSfile
special.");
+    return  -1;
+  }
+  args->curptr++;
+
   pro = malloc(args->endptr - args->curptr + 1);
   strncpy(pro, args->curptr, args->endptr -
args->curptr);
   pro[args->endptr - args->curptr] = 0;
@@ -766,7 +773,7 @@
 }
 
 static struct spc_handler dvips_handlers[] = {
-  {"header=",      spc_handler_ps_header},
+  {"header",      spc_handler_ps_header},
   {"PSfile",        spc_handler_ps_file},
   {"psfile",        spc_handler_ps_file},
   {"ps: plotfile",  spc_handler_ps_plotfile}, /* FIXME */
@@ -871,9 +878,6 @@
   if (args->curptr < args->endptr &&
       args->curptr[0] == ':') {
     args->curptr++;
-  } else if (args->curptr < args->endptr &&
-      args->curptr[0] == '=') {
-    args->curptr++;
   } else if (args->curptr+1 < args->endptr &&
              args->curptr[0] == '"' && args->curptr[1] ==
' ') {
     args->curptr += 2;

  If you are going to use pst-eucl package, then you may
want to try this patch as well:
Index: src/pdfdraw.c
===================================================================
--- src/pdfdraw.c	(revision 86)
+++ src/pdfdraw.c	(working copy)
@@ -1190,15 +1190,18 @@
     return -1;
   }
 
-  buf[len++] = ' ';
-  len += pdf_sprint_matrix(buf + len, M);
-  buf[len++] = ' ';
-  buf[len++] = 'c';
-  buf[len++] = 'm';
-  pdf_doc_add_page_content(buf, len);
+  if (fabs(M->a - 1.0) > 1.e-8 || fabs(M->b) > 1.e-8
+   || fabs(M->c) > 1.e-8 || fabs(M->d - 1.0) > 1.e-8
+   || fabs(M->e) > 1.e-8 || fabs(M->f) > 1.e-8) {
+    buf[len++] = ' ';
+    len += pdf_sprint_matrix(buf + len, M);
+    buf[len++] = ' ';
+    buf[len++] = 'c';
+    buf[len++] = 'm';
+    pdf_doc_add_page_content(buf, len);
 
-  pdf_concatmatrix(CTM, M);
-
+    pdf_concatmatrix(CTM, M);
+  }
   inversematrix(&W, M);
 
   pdf_path__transform (cpa, &W);

* Install xdvipdfmx and copy
$TEXMF/dvipdfm/config/svipdfmx.cfg
  to your personal TEXMF tree and edit it.  You need to
set 'D' and 'V'
  options correctly:
V 3
D  "gs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0
-sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -sOutputFile=%o
%i -c quit"
  or, if you are going to use transparent color support in
pstricks-add,
V 4
D  "gs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0
-sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sOutputFile=%o
%i -c quit"
  usually works.  But depending on the version of
ghostscript, you may
  have to add "-dSAFER" option as well.
* Now you must be able to use PSTricks macros in your
XeTeX source.
  If you are on MacOS X platform, then use
"-output-driver=xdvipdfmx"
  option to specify dvi driver explicitely.  The option is
not necessary
  on other platforms.

Known problems are:
* pst-text package is not yet supported;
* There is no plan to support pst-fill package;
* Ghostscript optimizes away all white graphic object,
  -- a workaround for rput*, n{a|b|c}put*, and so on is
implemented in
     xetex-pstricks.con,
  -- any suggestions for a real fix are welcome;
* Performance is really bad, and you need a lot of horse
power;
* pst-vue3d.tex doesn't work as is, due to an encoding
conflict
  between ISO8859-1 and UTF-8;
  -- either you have to put a space at the end of each
comment,
  -- or remove comments from the source;
* You name it.

I would appreciate bug reports, improvement suggestion,
code review
and anything else.

Regards,
SMiyata

--------------------------------------
Start Yahoo! Auction now! Check out the cool campaign
http://pr.mail.yahoo.co.jp/auction/




More information about the PSTricks mailing list