oBook‎ > ‎Latex Tips‎ > ‎

PSfrag

posted Jul 22, 2014, 6:52 PM by Javad Taghia   [ updated Jul 22, 2014, 6:52 PM ]
One easy way to create figures with latex formula is using PSfrag. For this purpose we need three things to do: 
1. Have a eps figure ready and put text boxes with tags on the figure. Then in the latex file we will substitute the tags with proper mathematical symbols. 
Eps files can be created and tagged by: Inkscape; GIMP or WinFig
2. We need to add \usepackage{psfragand \usepackage{graphicx,color} to our latex file. 
3. Using the following code arrangement:
\begin{figure}[h]
\centering
\psfrag{I1}[][]{$I_1$}
\includegraphics[scale=0.5]{efigs/testfig.eps}
\caption{}
\end{figure}
The following is other ways for using PSfrag:
 \psfrag{tag}[position][psposition][scale][rotation]{LaTeX construction}
\psfrag{Zfn}[Bc][Bc][0.9]{$f(n)$}
\psfrag{ZfnR}[Br][Br][0.9]{$f(n)$}
\psfrag{Za}[Bc][Bc][0.9]{$a$}
\psfrag{Zfnb}[Bc][Bc][0.9]{$f(n/b)$}
\psfrag{Zfnb2}[Bc][Bc][0.9]{$f(n/b^2)$}
\psfrag{ZafnbR}[Br][Br][0.9]{$a f(n/b)$}
\psfrag{Za2fnb2R}[Br][Br][0.9]{$a^2 f(n/b^2)$}
\psfrag{Zlogbn}[Bc][Bc][0.9]{$\log_b n$}
\psfrag{Znlogba}[Bc][Bc][0.9]{$n^{\log_b a}$}
\psfrag{ZT1}[Bc][Bc][0.9]{$\Theta(1)$}
\psfrag{ZTnlogbaR}[Br][Br][0.9]{$\Theta(n^{\log_b a})$}
\psfrag{ZTotalR}[Br][Br][0.9]{Total: $\displaystyle\Theta(n^{\log_b a}) +
\sum_{j=0}^{\log_b n-1} a^j f(n/b^j)$}
Comments