1

I want to practice psfrag but it does not work! I don't know what to do.

Here is my LaTeX document,

\documentclass[12pt]{amsart}
\usepackage[foot]{amsaddr}
\usepackage{mathrsfs}
\usepackage{graphics}
\usepackage{latexsym}
\usepackage{cite}
\usepackage{graphicx,psfrag}
\usepackage{amsmath,amssymb,amsthm,mathtools}
\begin{document}
  \begin{figure}
    \psfrag{a}{$x_{n-2}$}\psfrag{b}{$x_{n-1}$}
    \includegraphics[width=5cm]{edge.eps}
  \end{figure}
\end{document}

and here is my edge.eps file

ps. I installed TeX Live last week on tug.org and I use WinEdt 10.1.

ps 2. I'm not familiar to TeX, so I didn't touch any setting in WinEdt. I would appreciate if you would explain what to do.(sorry for bad English)

  • Welcome to TeX.SX! Do you use latex? It should work, if you use pdflatex, there's more to do. – user31729 May 28 '16 at 10:45
  • It works for me out of the box using latex. Output image -- in fact, I think this could be easier with tikz and directly drawing the graphics – user31729 May 28 '16 at 10:54
  • oh my default setting is pdflatex because my friend taught me pdflatex. However, in my image, it remains just as 'a' and 'b' – Taehee Hong May 28 '16 at 11:17
  • See my possible by-pass solution for pdflatex – user31729 May 28 '16 at 11:24
1

psfrag needs latex to compile (due to the .eps support).

However, with auto-pst-pdf package and the \includegraphics wrapper \psfragfig, it's possible to use pdflatex as well.

Make sure, that --shell-escape is enabled!

If graphicx is loaded, graphics don't needs to be loaded as well (because it's loaded by graphicx)

\documentclass[12pt]{amsart}
\usepackage[foot]{amsaddr}
\usepackage{mathrsfs}
\usepackage{latexsym}
\usepackage{cite}
\usepackage{graphicx,psfrag}
\usepackage{amsmath,amssymb,amsthm,mathtools}
\usepackage{auto-pst-pdf}
\begin{document}
  \begin{figure}
    \psfrag{a}{$x_{n-2}$}\psfrag{b}{$x_{n-1}$}
%    \includegraphics[width=5cm]{edge.eps}
    \psfragfig[width=5cm]{edge.eps}
  \end{figure}
\end{document}

enter image description here

  • Error message occured! ! Package auto-pst-pdf Error: "shell escape" (or "write18") is not enable: auto-pst-pdf will not work! – Taehee Hong May 28 '16 at 11:29
  • Well, yes, I wrote that it must be enabled – user31729 May 28 '16 at 11:30
  • @TaeheeHong: That's fine! – user31729 May 28 '16 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.