[XeTeX] XeTeX and postscript output
Ross Moore
ross at ics.mq.edu.au
Tue Feb 24 19:34:58 CET 2009
Hi Vafa,
On 24/02/2009, at 10:35 PM, وفا خلیقی wrote:
> Hi Ross, Alan Munn, Kirk Lowery and others
>
> you can use pdftricks directly in xetex.
>
>
> As far as I have tested pdftricks works in xetex but there is an
> isuue which I will talk about in a minute:
>
> say we only want to draw a line by pstricks, then you can have
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass{article}
> \usepackage{pdftricks}
> \begin{psinputs}
> \usepackage{pstricks}
> \end{psinputs}
> \begin{document}
> \begin{pdfdisplay}
> \TeXtoEPS
> \begin{pspicture}(0,0)(2,2)
> \psline(1,1)(2,2)
> \end{pspicture}
> \endTeXtoEPS
> \end{pdfdisplay}
> \end{document}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> then if we assume the name of the file is "test.tex", you will need
> to run "xelatex -shell-escape test" in a terminal/command line.
> then on the run xetex stops, produces the images in ps, then
> converts them to pdf and the run continues and eventually include
> them in the final pdf.
Yes.
What is happening is that pdftricks causes a separate
job to run, processing the contents of the {pdfdisplay}
environment. The separate job uses ordinary LaTeX + dvips
and Ghostscript, in the traditional way -- XeTeX isn't
involved at all while this is being done.
Once a PDF has been built, then XeTeX can include it
within the main document. All subsequent processing
runs can include this image, rather than rebuilding
it each time.
> But what happens if you actually have a text in pstricks
> environment which you want to be typeset in a particular font? will
> you see the text in the font you specified, or you get CMR fonts?
> the answer is you will get CMR font,
Yes, since LaTeX does not have the ability to use
fonts that are available to XeTeX.
There is an environment {psinputs} that is used
to control the header used when doing the separate
processing runs, to generate the images.
> for example try this:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass{article}
> \usepackage{fontspec}
> \setmainfont[Scale=1,Mapping=tex-text]{Junicode}
> \usepackage{pdftricks}
> \begin{psinputs}
> \usepackage{pstricks}
> \end{psinputs}
> \begin{document}
> \begin{pdfdisplay}
> \TeXtoEPS
> \begin{pspicture}(0,0)(2,2)
> \psline(1,1)(2,2)
> \uput[0](0,0){I want this to be typeset in \emph{Junicode} font.}
> \end{pspicture}
> \endTeXtoEPS
> \end{pdfdisplay}
> \end{document}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> But when you run "xelatex -shell-escape test", you see that in your
> output, the sentense "I want this to be typeset in \emph{Junicode}
> font." is typeset in CMR and not in Junicode.
This is because XeTeX has not been used when
processing the {pspicture} .
> But if you do not care about this, then you should be fine.
Indeed.
>
> Hope this helps
>
> --
> VK
pdftricks is a very useful package, whenever you have
material that requires running a PostScript interpreter.
This applies also when pdfLaTeX is your main engine,
as well as using it with XeLaTeX, as you have discovered.
I use it a lot to get the best display of mathematical,
linguistic or computer-science diagrams, using Xy-pic.
Cheers,
Ross
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
More information about the XeTeX
mailing list