This site will go down shortly. If you need any help, then please subscribe to The Persian TeX discussion mailing list
ask now - it's free

Most popular questions within the last 3 days

Most active Members
this month:
    +1 vote
    147 views

    How can I use the psfrag package with the xepersian package in XeTeX?

    \documentclass[12pt]{amsart}
    \usepackage[foot]{amsaddr}
    \usepackage{mathrsfs,float}
    \usepackage{latexsym}
    \usepackage{cite}
    \usepackage{graphicx,psfrag}
    \usepackage{amsmath,amssymb,amsthm,mathtools}
    \usepackage{xepersian}
    \settextfont[Scale=1.1]{Yas}
    \setdigitfont[Scale=1]{Yas}
    \setlatintextfont{Times New Roman}
    \begin{document}
    \begin{figure}[H]
        \psfrag{abb1}{\scriptsize{1997}}
        \psfrag{acb1}{ \tiny 1998}
        \psfrag{aeb1}{\tiny 1999}
        \psfrag{afb1}{\tiny 2000}
        \psfrag{agb1}{2001}
        \psfrag{ahb1}{2002}
        \psfrag{aib1}{2003}
        \psfrag{ajb1}{2004}
        \psfrag{akb1}{2005}
        \psfrag{alb1}{2006}
        \psfrag{amb1}{2007}
        \psfrag{anb1}{2008}
        \psfrag{aob1}{2009}
        \psfrag{apb1}{2010}
        \psfrag{arb1}{2011}
        \psfrag{asb1}{2012}
        \psfrag{atb1}{2013}
        \psfrag{aab1}{2014}
        \psfrag{bbb1}{7.6}
        \psfrag{bxb1}{10.2}
        \psfrag{beb1}{13.6}
        \psfrag{bfb1}{17.4}
        \psfrag{bgb1}{23.9}
        \psfrag{bhb1}{31.1}
        \psfrag{bib1}{39.4}
        \psfrag{bjb1}{47.6}
        \psfrag{bkb1}{59.1}
        \psfrag{blb1}{74.0}
        \psfrag{bmb1}{93.9}
        \psfrag{bnb1}{120.7}
        \psfrag{bob1}{159.1}
        \psfrag{bpb1}{198.0}
        \psfrag{brb1}{238.1}
        \psfrag{bsb1}{283.1}
        \psfrag{btb1}{318.6}
        \psfrag{bab1}{369.6}
        \psfrag{fpa}{50}
        \psfrag{gpa}{100}
        \psfrag{hpa}{150}
        \psfrag{ipa}{200}
        \psfrag{apa}{250}
        \psfrag{jpa}{300}
        \psfrag{bpa}{350}
        \psfrag{xxa}{400}
        \psfrag{ata}{\begin{tabular}{l} Cumulative Installed \\[-4pt] Wind Power (GW) \end{tabular}}
    \psfragfig[width=\textwidth]{Figure-Ch04-01.eps} %% Size: 12.7 x 5.7 cm
    \caption{Global cumulative installed wind power from 1997 to 2014 
    \cite{GWEC}.}
    \label{fig-global-cumulative}
    \end{figure}
    \end{document}
    
    Uploaded File:
    asked by
    retagged by

    1 Answer

    0 votes
     
    Best answer

    Unfortunately, I could not run TeX on your provided minimal example since it complained about the control sequence \psfragfig being undefined with my version of the package psfrag (perhaps you are using an earlier version).

    I can reproduce the problem with the following minimal example taken from psfrag manual.

    \documentclass{article}
    \usepackage{graphicx}
    \usepackage{psfrag}
    \begin{document}
    \psfrag{p1}{$p_1$}
    \psfrag{p2}{$p_2$}
    \psfrag{p3}{$p_3$}
    \psfrag{\\tex[B][B]\{Plot of \$\\sin(t)\$ and \$\\cos(t)\$\}}{Plot of $\sin(t)$ and $\cos(t)$}
    \psfrag{\\tex[t][t]\{\$t\$\}}{$t$}
    \psfrag{\\tex[B][B]\{\$\\sin(t)\$, \$\\cos(t)\$\}}{$\sin(t)$, $\cos(t)$}
    \psfrag{-1}{$-1$}
    \psfrag{-0.2}{-0.2}
    \psfrag{-0.4}{-0.4}
    \psfrag{-0.6}{-0.6}
    \psfrag{-0.8}{-0.8}
    \psfrag{0}{0}
    \psfrag{0.2}{0.2}
    \psfrag{0.4}{0.4}
    \psfrag{0.6}{0.6}
    \psfrag{0.8}{0.8}
    \psfrag{1}{1}
    \psfrag{2}{2}
    \psfrag{4}{4}
    \psfrag{6}{6}
    \psfrag{8}{8}
    \psfrag{10}{10}
    \includegraphics[width=.6\textwidth]{example.eps}
    \end{document}
    

    where the image file example.eps can be downloaded from CTAN.

    Let's make two things clear

    • The issue has nothing to do with the xepersian package;
    • This is mainly a driver issue.

    If you run latex+dvips+ps2pdf, then you will get what you expect. To understand what is going on with XeTeX, try

    xelatex -no-pdf <filename.tex>
    

    and then

    xdvipdfmx <filename.xdv>
    

    If you do this, you should see a lot of warnings from xdvipdfmx.

    xdvipdfmx:warning: Unknown token "where"
    xdvipdfmx:warning: Interpreting PS code failed!!! Output might be broken!!!
    xdvipdfmx:warning: Interpreting special command ps: (ps:) failed.
    xdvipdfmx:warning: >> at page="1" position="(148.712, 459.953)" (in PDF)
    xdvipdfmx:warning: >> xxx "ps: /PSfrag where{pop(p1)[[0(Bl)1 0]](p2)[[1(Bl)1 0]](p3)[[2..."
    xdvipdfmx:warning: >> Reading special command stopped around >>{pop(p1)[[0(Bl)1 0]]
    ...
    

    This makes it clear that this is the driver issue. Having said that, you have few options

    • Remove all text labels from your eps file, convert it to PDF and use the package overpic to put labels on your image;

    • Use either package pstool or package auto-pst-pdf;

    • All other similar approaches.
    answered by (3.1k points)
    selected by
    ...