3

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. –  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 –  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 –  May 28 '16 at 11:24

1 Answers1

2

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