I'm using the PSFrag package to embed LaTeX labels into my EPS figures (which I then import into my LaTeX document), which works fine except that my LaTeX labels aren't very visible, because the background on which they are superimposed is too crowded. My solution is to insert a rectfill command into the EPS document right before the dummy label which gets replaced by PSFrag. However, figuring out the proper dimension and position of this rectangle is a very time consuming process, in particular because I need to recompile everything to see the changes.
I don't know how exactly PSFrag does its magic, but is there a way to get the bounding box of the LaTeX label, so that I can automate this process? My attempt ('(g1)' is the dummy label to be replaced by PSFrag)
gsave (g1) true charpath pathbbox 0.5 setgray rectfill grestore (g1) show
charpath only gives me the bounding box of the dummy label, not the LaTeX label it gets replaced with.