2.4 LATEX & Co
2.4.1 epspdfconversion
Information about the package epspdfconversion can be found at CTAN.
2.4.2 add pstricks/LATEX-code to an eps-graphic
Consider you have an eps-graphic file. It could be the result of an export from Stata, MATLAB, Maple
or whatever. Sometimes it is necessary to add some notation or additional graphical elements like
arrows or boxes.
One way to do that is to use pstricks and/or LATEX. This is how this can be done
- Make your .eps-file part of an \begin{pspicture} ... \end{pspicture}-environment: Create a
file my-epsoverlay.tex (or so) that looks like this:
\documentclass{article} \usepackage{graphicx} \usepackage{pstricks} \usepackage{pstricks-add} \usepackage{pst-plot} \usepackage{pst-text,pst-node,pst-tree} \begin{document} \pagestyle{empty} \newsavebox{\Imagebox} %%%% %%%% HERE: Load the eps-file %%%% \savebox{\Imagebox}{\includegraphics{epsgraph.eps}} \centering %%%% %%%% HERE: add LaTeX/pstricks %%%% \begin{pspicture}(\wd\Imagebox,\ht\Imagebox)% \rput[lb](0,0){\usebox{\Imagebox}} % grid to see coordinates, comment out when done \psgrid[subgriddiv=0,griddots=1,gridlabels=7pt]% (0,0)(\wd\Imagebox,\ht\Imagebox) % Add labels etc here: \rput{0}(5.9,3.9){$b = 1$} \rput{0}(3.4,2.2){$b = 5 $ nicht verwendet} \rput{0}(2.9,1.2){$b = 10 $} \rput{0}(0.5,8.1){$k(t)$} \rput{0}(6.7,0.4){$t$} \end{pspicture} \end{document}
- Add code as in the my-epsoverlay.tex-file.
- Then run latex-dvips-ps2pdf13 on that file. In TeXShop, this can be done with an “engine” that
looks like that:
#!/bin/tcsh set path= ($path /usr/texbin /usr/local/bin) set filename = "$1" set dviname = "${filename:r}.dvi" set psname = "${filename:r}.ps" set pdfname = "${filename:r}.pdf" set pdfnamebb = "${filename:r}-bb.pdf" set epsnamebb = "${filename:r}.eps" set auxname = "${filename:r}.aux" set logname = "${filename:r}.log" # run latex via ghostscript on the tex-file latex --shell-escape "$1" dvips -Ppdf -o "$psname" "$dviname" ps2pdf13 -dAutoRotatePages=/None "$psname" "$pdfname" # calculate bounding box epspdf -bb "$pdfname" "$epsnamebb" epspdf -bb "$pdfname" "$pdfnamebb" # clean up /bin/rm "$pdfname" /bin/rm "$dviname" /bin/rm "$auxname" /bin/rm "$psname" /bin/rm "$logname" #rename pictures mv "$pdfnamebb" "$pdfname"
The code above assumes that the commands latex, dvips, ps2pdf13, /bin/rm, mv and
epspdf are available on your system. Especially epspdf is non-standard, you may
need to install it separately from your LATEX-installation. See the documentation of
epspdfconversion (2.4.1). If you are using a recent TeXLive-Installation, epspdf is already part of
it.
Other LATEX-Editors/Frontends may provide other ways to apply the commands on your
my-epsoverlay.tex-file.
- Now you have two file epsgraph.eps and epsgraph.pdf that can be used in LATEX oder
pdfLATEX.
2.4.3 Links