Using Imported Graphics in LaTeX and pdfLaTeX - Mirror
Using Imported Graphics in LaTeX and pdfLaTeX - Mirror
Using Imported Graphics in LaTeX and pdfLaTeX - Mirror
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
An additional benefit of psfrag rewrite is that it now supports compressed eps<br />
graphics. However, the \tex comm<strong>and</strong> (described <strong>in</strong> Section 15.3 on Page 48) cannot<br />
be used to embed L A TEX text <strong>in</strong> compressed graphics.<br />
Problems<br />
with Kern<strong>in</strong>g<br />
To use psfrag, create an eps file <strong>and</strong> then perform the follow<strong>in</strong>g steps<br />
1. Include \usepackage{psfrag} <strong>in</strong> the preamble of the L A TEX document.<br />
2. In the document, use the \psfrag comm<strong>and</strong> to specify the eps text to replace<br />
<strong>and</strong> the L A TEX str<strong>in</strong>g to replace it. This makes the specified substitution occur<br />
<strong>in</strong> any subsequent \<strong>in</strong>cludegraphics comm<strong>and</strong> issued <strong>in</strong> the same environment.<br />
3. Use the \<strong>in</strong>cludegraphics comm<strong>and</strong> as usual.<br />
The L A TEX \psfrag comm<strong>and</strong> has the follow<strong>in</strong>g syntax<br />
\psfrag{PStext}[posn][PSposn][scale][rot]{text}<br />
with its arguments described <strong>in</strong> Table 5.<br />
The posn <strong>and</strong> PSposn options are one of the 12 po<strong>in</strong>ts (such as [tl], [br], [cc])<br />
shown <strong>in</strong> Figure 3 on Page 28. If the optional arguments are not issued, the po<strong>in</strong>t<br />
defaults to [Bl]. Any miss<strong>in</strong>g letters default to c (e.g., [ ] <strong>and</strong> [c] are equivalent<br />
to [cc], [l] is equivalent to [lc]). See [29] for examples of various comb<strong>in</strong>ations of<br />
placement po<strong>in</strong>ts.<br />
Note that \psfrag matches entire text str<strong>in</strong>gs. Thus the comm<strong>and</strong><br />
\psfrag{pi}{$\pi$}<br />
replaces the str<strong>in</strong>g pi with π, but does not affect the str<strong>in</strong>gs pi/2 or 2pi. Separate<br />
\psfrag comm<strong>and</strong>s must entered for these str<strong>in</strong>gs.<br />
psfrag cannot perform the replacement unless the entire eps str<strong>in</strong>g is constructed<br />
with a s<strong>in</strong>gle PostScript comm<strong>and</strong>. Some programs break str<strong>in</strong>g up <strong>in</strong>to sub-str<strong>in</strong>gs<br />
or <strong>in</strong>dividual letters <strong>in</strong> order to perform kern<strong>in</strong>g. For example, Corel Draw produced<br />
the follow<strong>in</strong>g eps code to place the str<strong>in</strong>g “Hello World”<br />
0 0 (Hello W) @t<br />
1080 0 (orld) @t<br />
S<strong>in</strong>ce psfrag sees this as two unrelated str<strong>in</strong>gs “Hello W” <strong>and</strong> “orld”, it cannot<br />
perform any replacement of “Hello World”. If the kern<strong>in</strong>g cannot be manually turned<br />
off, us<strong>in</strong>g Courier or other monospaced fonts often prevents the kern<strong>in</strong>g 21 . If the<br />
kern<strong>in</strong>g cannot be avoided, only s<strong>in</strong>gle-character replacement str<strong>in</strong>gs can be used.<br />
15.1 PSfrag Example #1<br />
The comm<strong>and</strong>s<br />
\<strong>in</strong>cludegraphics{pend.eps}<br />
<strong>in</strong>clude the graphic without any psfrag replacement, produc<strong>in</strong>g Figure 9. The comm<strong>and</strong>s<br />
\psfrag{q1}{$\theta_1$}<br />
\psfrag{q2}{$\theta_2$}<br />
\psfrag{L1}{$L_1$}<br />
\psfrag{L2}{$L_2$}<br />
\psfrag{P1}[][]{$P_1$}<br />
\psfrag{P2}[][]{\large $P_2$}<br />
\<strong>in</strong>cludegraphics{pend.eps}<br />
21 In order to avoid kern<strong>in</strong>g, the font may need to be set to Courier before the text is created.<br />
That is, creat<strong>in</strong>g the text <strong>and</strong> then convert<strong>in</strong>g it to Courier may still result <strong>in</strong> kern<strong>in</strong>g.<br />
46