# LaTeX, PSTricks, pdfTeX and Kile

Many people writing scientific documents in TeX know the problem: on one hand, you want to use the more modern pdfTeX rather than LaTeX, for example because of the hyperref package or because you want to include pdf, png or jpg images. On the other hand, pdfTeX fails to produce figures that make use of PostScript, as is the case when using the very useful PSTricks. There are a number of possible ways around this problem. What is working well for me right now is a solution kindly provided by Wolfgang. Create PSTricks figures as separate documents using the following skeleton:

\documentclass{article}
\usepackage{pstricks}
\pagestyle{empty}
\begin{document}
% your graphics here
\end{document}

Then autocrop the document and save it as a PDF file using the following shell script:

#!/bin/sh

latex $1.tex dvips$1.dvi
ps2eps -l --nohires -f $1.ps ps2pdf -dEPSCrop -dAutoRotatePages=/None -dUseFlateCompression=true$1.eps

Then you can include the graphics (in PDF format) from your main document, which you build using pdfTeX.

Since I use Kile for writing in TeX, I replaced the shell script with a build tool which I called IlluTeX. It amounts to the following additions in ~/.kde/share/config/kilerc:

[Tool/IlluTeX/Default]
autoRun=no
checkForRoot=no
class=Sequence
close=no
jumpToFirstError=no
menu=Compile
sequence=LaTeX,DVItoPS,PStoEPS,PStoPDFEPSCrop,ViewPDF
state=Editor
to=pdf
type=Sequence

[Tool/PStoEPS/Default]
class=Convert
close=no
command=ps2eps
from=ps
menu=Compile
options=-l --nohires -f '%S.ps'
state=Editor
to=eps
type=Process

[Tool/PStoPDFEPSCrop/Default]
class=Convert
close=no
command=ps2pdf
from=eps
menu=Compile
options=-dEPSCrop -dAutoRotatePages=/None -dUseFlateCompression=true '%S.eps' '%S.pdf'
state=Editor
to=pdf
type=Process

## 5 Gedanken zu „LaTeX, PSTricks, pdfTeX and Kile“

1. DrNI

Not to forget: Only pdflatex has support for the microtype package. This is what keeps me from using xetex. Microtype enhances the pdflatex output quite a bit.

2. aleks

Interesting. I’ve opted for XeTeX instead of microtype trickery – the allure of using .otf, .ttf, and .dfonts and Unicode was just too big. I guess, both have their merit. Microtype *does* look pretty.

Another hint for those wishing to use pstricks: use latexdraw (package is in Ubuntu) to draw them figures. Or just forget that old-fashioned anachronism and use inkscape and graphviz.

3. ke Beitragsautor

Thanks for all the hints! latexdraw sounds nice, so does XeTeX, in another context: I’ve been meaning to create my own A0 Unicode poster for a long time and recently found out that scraping the PNG character previews from one particular Unicode web site in blatant disregard of its terms of use, arranging them in a PDF document using a PHP library and then hoping ZDV’s poster printer is up to the task may not be the way to go. I think my next attempt will be XeTeX-based. I’ve already collected a heap of Unicode fonts specializing on different blocks, but I’m not satisfied yet. What good is it having a Unicode poster if it doesn’t show the Samaritan alphabet, for example? At the moment I have very little spare time so the project is on hold, but being aware of XeTeX, I’m extra motivated now…

4. DrNI

I’m looking forward to your Unicode poster.

Meanwhile I’m fontcrastinating by checking out the subtle differences of Linux Libertine and Linux Biolinum vs. Gentium and Ottawa (shipped with old versions of Corel Draw). I can’t decide which pair I like better. I guess Libertine is more thesisish and Gentium more novelish.

5. ke Beitragsautor

Ah, the joys of thesis formatting (I’m assuming it’s for your thesis). I think it’s always a good idea to do that early on, a good layout puts the heart at ease and frees the spirit for the content.