What programs do people use to put their tags on ready to be replaced by psfrag? I've tried inkscape but if I write in the text "hello" say with inkscape then export as eps PSfrag doesn't seem to replace the tags I added (although it does replace tags I put on in Mathematica).

Is there a better graphics program out there for doing this tagging?

2 Answers 2


Psfrag relies on the text being placed being pretty simple, in particular, if you want to replace hello then hello needs to be placed as a single string in the postscript file (that is, most likely the string (hello) including parenthesis appears in the EPS file). If the application aims for any typographic improvements and instead of setting the word as a simple postscript string, places each letter with fine tuning kerning adjustments, then psfrag will not find the text.

So if you know when making the eps that you are going to use psfrag, it sometimes helps to restrict to single letter labels h rather than hello as they have the best chance of not being disturbed. Alternatively if the EPS is already made, look at the file in a text editor and search for text strings (not allays possible if compression filters have been used) for example hello may be set as (he) some postscript (ll) some postscript (o) in which case you need to use those strings in psfrag, mapping he to your replacement text and the other two to nothing.

Update it appears that newer versions of inkscape do complicate the EPS output too much for psfrag, a workaround (that I haven't unconfirmed) is detailed here http://tavmjong.free.fr/INKSCAPE/MANUAL/html/File-Export.html which says

As of v0.47, this method will fail as the Cairo-based export uses font subsetting (storing only the characters actually used and then using an index to reference these characters) to save space thus your strings can't be found. A work-around is to search the PostScript file for strings of the form <01020304>Tj or [<010203>-1<0405>-1<06>-1<07>1<08>129<090a06>]TJ and replace them by strings of the form (Export Test)Tj. It is probably better just to use the previous method of saving a PDF, PostScript, or EPS file with a LaTeX overlay


  • I tried opening the EPS in inkscape and just inserting a 'h', bust PSfrag still not finding it. In fact my Mathematica tags (that worked prior to opening and exporting in inkscape) are now not being found. So I guess inkscape is converting the text in some way: I just do Save As>EPS (then deselect save 'text as paths', I have tried both postscript level 2 and 3). I think Inkscape is compressing the EPS as it comes out smaller (even though I set dpi to highest avail and I can't see a txt in EPStxt. There must a standard graphics program or alternative way people are doing their tagging?
    – fpghost
    Mar 26, 2012 at 9:22
  • see updated comment re inkscape/psfrag compatibility Mar 26, 2012 at 10:12
  • Thanks that is helpful and does work, although it is quite a lot of effort one has to put in for latex EPS one wishes to produce. I would like to know if someone could recommend another vector graphics editor that does the job better than inkscape (now their new version has messed things up).
    – fpghost
    Mar 26, 2012 at 11:33
  • 2
    It seems that this issue has been resolved in cairo: https://bugs.launchpad.net/inkscape/+bug/375323/comments/90
    – cgnieder
    Mar 28, 2012 at 16:37

To answer the starting question (What programs do people use to put their tags on ready to be replaced by psfrag?): I use CorelDRAW for nearly all my EPS figures. Be sure to check (in the export dialog) Export Text as Text, but you can safely uncheck Include font to save some space and keep the EPS file tidy.

To get round the problem with the "typographic improvements" as mentioned by David Carlisle I use a monospaced font, i.e. Courier New for example. This worked flawlessly for many, many figures so far. Perhaps you can try this "trick" also with Inkscape.

Slightly OT, but here's a small piece of code I use to get all tags out of my figure:

perl -e 'my %str; while (<>) { $_ =~ /\(.+\)/ or next; chomp($_); $_ =~ s/.*\((.+)\).*/\1/; if (not $_ =~ / /) { $str{$_} = "$_"; }}; my @sstr = sort { lc($a) cmp lc($b) } keys %str; foreach(@sstr) {print "\\psfrag\{$_\}\{$str{$_}\}\n"; }' < figure.eps

It skips all valid psfrag targets which contain blanks (anyway, this would be a bad tag), to get rid of some descriptions included in the EPS. You will get a sorted list of all target strings, ready for copy & paste:


However, there are still some unwanted psfrag targets (Black, Yellow, ...) if using CorelDRAW. It's annoying to delete those lines, but that way you can be sure that no tag is forgotten.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.