[Tex/LaTex] PdfTexify versus dvi2pdf: problem with eps figure

epsgraphicspdfwinedt

I have problem to get eps pictures when I use PdfTexify in WinEdt 8.0 (MikTeX 2.9).
It works if I use dvi2pdf, but I prefer PdfTexify, because it allows me to include attachments in pdf file as well as to make hyperlinks on references.
Here is sample code

\documentclass[aps,pra,amsmath,amssymb,twocolumn,showpacs]{revtex4-1}
\usepackage{epsf}
\usepackage{graphicx}
\usepackage{attachfile}
\begin{document}
\begin{figure}[htb]
   \epsfxsize=6.5cm\centering{\epsfbox{f/1.eps}}
\end{figure}
check attached here \attachfile{2013-05-17.nb}
\end{document}

Also, I would like to know which of those two ways to get PDF output is more preferred/professional? Or is there a more professional way? Thank you in advance.

Best Answer

Actually, epsf is a package designed to include .eps files in plain .tex files.

Anyway, if you want to continue using it in your document and, at the same time, you want to solve your problems with attached files, you can use the package attachfile2 with the option dvipdfmx instead of the package attachfile.

Simply substitute the line

\usepackage{attachfile}

with

\usepackage[dvipdfmx]{attachfile2}

so to have

\documentclass[aps,pra,amsmath,amssymb,twocolumn,showpacs]{revtex4-1}
\usepackage{epsf}
\usepackage{graphicx}
\usepackage[dvipdfmx]{attachfile2}
\begin{document}
\begin{figure}[htb]
   \epsfxsize=6.5cm\centering{\epsfbox{f/1.eps}}
\end{figure}
check attached here \attachfile{2013-05-17.nb}
\end{document}

Now you will be able to have the .pdf with the correct references to attached files compiling with the sequence latex -> dvi2pdf in WinEdt.


In regards of WinEdt, I remind you that PDFTeXify is a command that runs pdflatex, bibtex and makeindex as many times as needed for a completely compiled .pdf file.

You can change its behavior to run latex and subsequently dvipdfmx instead of pdflatex to accomplish your needs.

To do that, run the "Execution Modes" interface from the "Options" menu. Then select the page "TeX Options" and change the "PDFTeXify Method" from "Default" to "dvi -> pdf", as shown in the image below.

enter image description here

Turn things back to have its usual behavior.


Update

Anyway, I think you'd better use a more modern way to load .eps files in your document and use pdflatex to compile it.

I suggest to use the epstopdf package, which converts your 1.eps file to 1-eps-converted-to.pdf at runtime and uses it instead of the .eps one.

Remember to load the epstopdf package after graphicx or you might get errors.

Your MWE can be rewritten as

\documentclass[aps,pra,amsmath,amssymb,twocolumn,showpacs]{revtex4-1}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{attachfile}
\begin{document}
\begin{figure}[htb]
  \centering
  \includegraphics[width=6.5cm]{f/1.eps}
\end{figure}
check attached here \attachfile{2013-05-17.nb}
\end{document}

and compiled with PDFTeXify with no changes in WinEdt.