Up: Elements reference



<psfrag> – graphics label replacement

Attributes:

tag
text tag in the eps file (required)
number
is it a number? ("true"/"false")
contrast
"boxed" for white label background. "inverse" for white text colour.
relsize
"large"/"small". default: "normal".
align
alignment: "left" (default), "right", "center", "ccenter"
interval
automatic number generation
xml:lang
human language (inherited)
id
unique name (identifier)
style/class
style properties and class (e.g. for CSS)

Possible Contents: (Text | inline element)*

Description: The tag is searched in the surrounding vector graphics and the contents of the <psfrag> is substituted for it:

<psfrag tag="x-axis"><m>x</m>-axis</psfrag>

For this I use of course the fantastic Psfrag package. Is <psfrag> empty, tag is substituted for itself, which means that only font and size is adjusted to the main document:

<psfrag tag="Diagram"/>

If you want to erase something from an image, you have to replace it with whitespace:

<psfrag tag="was dull"> </psfrag>

align determines alignment relatively to the replaced tag:

"left"
left on the same baseline.
"right"
right on the same baseline.
"center"
centred on the same baseline.
"ccenter"
horizontally and vertically centred.

number is "true" by default, if tag is obviously a number, or if interval is given, else "false".

contrast="boxed" sets the substitution on a white rectangle. contrast="inverse" shows the substitution in white colour. One of both may be necessary for too dark/chaotic backgrounds.

relsize should be clear.

interval consists, if given, of three semicolon separated numbers: start, end and step. Thus interval="0;10;1" yields automatically Psfrag substitutions for all numbers between 0 and 10. This is very convenient for EPS files with a labeled axis. By the way, tag plays in this case the role of a pattern for the numbers in the EPS file. This works somehow according to the DecimalFormat routine of Java 1.1, if anybody knows this.

Some examples:

<psfrag tag="#" interval="1;10;2"/>

replaces 1, 3, 5, 7 and 9 by itself (i.e., it changes the font only). Now for something more complicated:

<psfrag tag="#.0" interval="-4.5;-6;-0.5">#,0</psfrag>

replaces -4.5, -5.0, -5.5 and -6.0 by the same numbers, but with a comma instead of a point (for our non-English friends). Additionally,

<psfrag tag="#.0" interval="-4.5;-6;-0.5">#,#</psfrag>

does the same, but in the output post-comma digits (and the comma) are omitted where they are zero anyway. Last example:

<psfrag tag="0.0" interval="-1.5;1;0.5">#,#</psfrag>

does the following substitutions: -1.5 => -1,5, -1.0 => -1, -0.5 => -0,5, 0.0 => 0, 0.5 => 0,5 and 1.0 => 1.

Besides, it doesn't do any harm if you declare too many replacements, so you can use the same <psfrag> for all your diagrams, for example.