# How to edit a eps file in Latex?

I'm using sharelatex to write my documents. Now I've got a problem. Google couldn't help me and sharelatex support recommend you guys for my "in-depth LaTeX questions". My problem is that i want to make a document with eps files. This eps files have marks which should been replaced.

In my example the marks will be replaced if i use the LaTeX compiler from sharelatex. But with the use of the latex compiler the pdf file will not been shown. At first the compiler couldn't determine the size of the pdf file. Natwidth and natheight remove the problem to determine the size but now the document ends before the figure.

I would be very thankful if you can help! Maybe there is away to edit the eps file with pdflatex compiler (\psfrag* don't work with that compiler) or a way to inculde pdf files as figures in my document?

You can find the eps and pdf file here.

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{chemstyle}
\usepackage{psfrag}

\begin{document}

This is the first page. \compound{first}

\begin{figure}
\center
\psfrag*{mark1}[c][c]{\compound{first}}
\psfrag*{mark2}[c][c]{\compound{second}}
\includegraphics{test1.eps}
\end{figure}

\newpage

\begin{figure}
\centering
\includegraphics[width=\textwidth, natwidth=297mm, natheight=210mm]{test2.pdf}
\end{figure}
\end{document}

• Sorry! I deleted a { when I copied the example. Nov 9, 2016 at 12:15

if I delete

\begin{figure}
\centering
\includegraphics[width=\textwidth, natwidth=297mm, natheight=210mm]test2.pdf}
\end{figure}


which has a missing { and can not work with the latex/dvips/ps2pdf workflow

and (unrelated) change the \center in the first figure to \centering then I get

with \compound making 1 and 2 as I assume is required.

Using

 latex file; dvips file; ps2pdf file.ps


to produce file.pdf

• yes. that works also at sharelatex. But how can i include a pdf file as picture in the same document ? Nov 9, 2016 at 17:07
• @vincentm9 if using latex use an external tool to convert the pdf to eps. Or if using pdflatex for the main document leave that one as pdf and include the first image as pdf which you can make using a separate run with latex with a little document that just converts one image, as above. Nov 9, 2016 at 17:15