Latex in postscript figures

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

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


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

(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 -f -g -l
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