Latex in postscript figures

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
Antony Lewis
Posts: 1498
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Latex in postscript figures

Post by Antony Lewis » February 22 2005

Took me a while to figure this out.. say you have plot with plain text labels, and you want to convert them to some maths in Latex. You can use psfrag to do this, however some journals complain about psfrag, so here's how to make a standalone .eps file from a .ps file with psfrag replacements.

* Make .ps file as normal

* Make a dummy .tex file doing the psfrag replacements, e.g.

Code: Select all

\documentclass{article}
\usepackage{epsfig,psfrag}
\pagestyle{empty}
\begin{document}

\begin{figure}
\begin{center}
\psfrag{CT}[][][1.2]{$l(l+1) C_l / 2\pi \mu K^2$}
\psfrag{l}[][][1.2]{$l$}
\psfig{figure=series_contribs.ps,angle=0,width = 12cm}
\end{center}
\end{figure}

\end{document}
(here I'm replacing CT with [tex]l(l+1) C_l / 2\pi \mu K^2[/tex] and l with [tex]l[/tex]).

* latex and dvips the file

* Open the new .ps file in gsview

* Use "PS to EPS" on the File menu to convert to a nicely tightly clipped .eps file.

This works with the Windows GSview program anyway. Alternative if you have ps2eps installed use

Code: Select all

latex %1.tex
dvips %1
perl ps2eps.pl -f -g -l %1.ps
where %1 is "dummy" or other file name.

For Matlab fans, using the above recipe generates .eps files typically 5 times smaller than putting in the latex in matlab 7 using 'Interpreter','Latex' labels.

Post Reply