4

I have generated EPS and TeX files from Matlab. Now I notice if I scale my image the text gets badly scaled such that my axis names are sitting on my axis even if I reduce the text size to \scriptsize.

I would like to move the place holders for the text in the EPS file a little further from the axis. That I tried with Adobe Illustrator but it did not work out. Instead my place holders where not replaced anymore.

Do I have to consider a certain file format or font type? I am using pdflatex and pstool.

Thanks for any suggestions.

Werner
  • 603,163
NanisTe
  • 135

1 Answers1

4

Two options:

  1. Recreate the image so you don't have to scale the content. This would allow you to fine-tune the placement of the replacement text.

  2. Use horizontal spacing techniques within the replacement text of \psfrag{<tag>}{<replace>} to push the content left/right. For example, \psfrag{xy}{$xy$\hspace{1cm}} would push the content 5mm to the left (since the default replacement positioning is centered. For consistency, and easy of tweaking, define a macro that you can use with specific sets of replacements.

Remember that the full interface provided by psfrag is:

\psfrag{<tag>}[<posn>][<psposn>][<scale>][<rot>]{<replacement>}

I also suggest playing around with <posn> and <psposn>:

[<posn>]

the LaTeX text reference point. The syntax of this argument is identical to that of the \makebox command. Up to two letters may be chosen, one from the list {t,b,B,c}, (top, bottom, baseline, center) and another from {l,r,c} (left, right, center). If either letter is omitted, then c (center) is assumed. Together, these specify one of 12 anchor points. If the argument is omitted altogether, then [Bl], or left baseline positioning, is assumed—but note that supplying [] specifies centered positioning. When running in LaTeX 2.09 compatibility mode, the default alignment is [bl], in order to support legacy documents. Usually this should not make a significant difference.

[<psposn>]

the PostScript text reference point. The possible arguments are identical to that of [posn], as is the default value, [Bl] ([bl] in LaTeX 2.09 compatibility mode.)

See the psfrag documentation for more detail.

Werner
  • 603,163
  • You solution was the easiest way doing what I asked to do. Thank you for that. But independent of my problem is there a posibility to edit the EPS in Adobe Illustrator or Photoshop to add graphics into the plot which I can not do with Matlab. If so what do I have to consider that pstool still notices the placeholders. Which file format do I have to use or what is the special thing I have to consider when saving the edited EPS file. It did not recognise the placeholders after saving it with Adobe Illustrator. Thanks a lot – NanisTe Feb 16 '14 at 17:23
  • @Nixdae: That would be exactly the thing you need to look out for. From the psfrag documentation: "Make sure that your EPS figures contain a simple “tag” word in each position that you would like a LaTeX replacements. Use a single word, composed of unaccented letters and numbers. Some effort has been made to allow for more arbitrary tag text, but the mechanism is not infallible; see section 8.1." If the editor (Adobe or otherwise) changes this, psfrag will fail. – Werner Feb 17 '14 at 00:21
  • Hi Werner, thanks for your help. How is it about cropping a single image with this solution? Since pdfcrop-options is a package option it is not applicable. Is there any solution I can define the pdfcrop options inside my tex file of the figure. So that I can crop my images individually. In some cases I want to get rid of my title and just replacing the placeholder without no text does not solve it. I still get same white space above the graphic as before.

    Best regards

    – NanisTe Feb 19 '14 at 10:48
  • 1
    @Nixdae: Since you're supposed to use \includegraphics with psfrag-included images, you can use the bb=<llx> <lly> <urx> <ury>,clip option to specify a new bounding box for your image. Here you're updating the lower-left (x,y) and upper-right (x,y) coordinates. Read about it in the graphicx documentation (p 10). Also see Clipping a figure to content where the viewport key is used with a similar interface to bb. – Werner Feb 19 '14 at 12:11
  • For others who want to use Adobe Illustrator for generating or editing the EPS files this link could be helpful. getting-illustrator-to-play-nicely-with-psfrag – NanisTe Feb 21 '14 at 00:09