Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In a recent discussion on this site I learned that using

\usepackage[pdf]{pstricks}

makes it possible to run pdflatex on files containing eps and pstricks files (and psfrag usage as well). Now a couple of questions:

  1. If a file does not contain pstricks, just eps and psfrag, this method can still be used. But is there a method to do this that does not require loading pstricks? I know that auto-pst-pdf is one approach, another one is to load epstopdf, are there any other ways to achieve this without loading these files? Maybe by adding an option to graphicx?

  2. In all these approaches, every time that pdflatex is run all eps and pstricks files are converted to pdf files, even if they have not changed. Is there an approach that prevents it and only converts to pdf if a file has been changed from last compilation?

Thanks

share|improve this question
    
Are the two subquestions actually related? If not, it might make sense to separate them. –  blubb Dec 16 '11 at 19:15
    
I have to add that epstopdf cannot handle psfrag. Both auto-pst-pdf and \usepackage[pdf]{pstricks} handle psfrag with no problem. –  Per Dec 16 '11 at 19:49
add comment

3 Answers

TeX Live 2010 and 2011 automatically convert EPS files to PDF, but it looks like it keeps converting, even when the EPS file hasn't changed. Working from Herbert's suggestion, this should do the trick. It may also work with other distributions, but I've not tried.

\documentclass{article}
\usepackage{graphicx}
\usepackage{epstopdf}
\epstopdfsetup{update} % only regenerate pdf files when eps file is newer
\begin{document}
\includegraphics[width=\textwidth]{sine} % loads sine-eps-converted-to.pdf
\end{document}
share|improve this answer
    
On my system it does not keep converting if the eps file is not changed... Maybe difference in epstopdf.cfg? –  Boris Dec 16 '11 at 19:47
    
Maybe. I thought I had a stock TeX Live 2011 install on Windows with no explicit modifications to epstopdf.cfg, but things might be different on another OS, or I could simply be wrong about the auto-update, or the nature of my epstopdf.cfg. –  Mike Renfro Dec 16 '11 at 19:57
    
aha... on Windows there could be problems with timestamps... Sorry, I do not have a Windows box to check –  Boris Dec 16 '11 at 19:59
add comment
  1. In a modern system a foo.eps file in \includegraphics{foo}, if present, is automatically converted to foo.pdf during pdflatex run.

  2. This conversion is done only once, so foo.pdf is left for the next runs. If you change your eps file, it will be regenerated.

Consider this example:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{tmp1}
\end{document}

When I ran it, I had file tmp1.eps, but no tmp1.png or tmp1.pdf in my working directory. The log said:

(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package epstopdf Info: Source file: <tmp1.eps>
(epstopdf)                    date: 2011-12-12 13:41:25
(epstopdf)                    size: 15351 bytes
(epstopdf)             Output file: <tmp1-eps-converted-to.pdf>
(epstopdf)             Command: <repstopdf --outfile=tmp1-eps-converted-to.pdf 
tmp1.eps>
(epstopdf)             \includegraphics on input line 4.
runsystem(repstopdf --outfile=tmp1-eps-converted-to.pdf tmp1.eps)...executed sa
fely (allowed).

Package epstopdf Info: Result file: <tmp1-eps-converted-to.pdf>
(epstopdf)                    date: 2011-12-16 14:36:28
(epstopdf)                    size: 7774 bytes.

<tmp1-eps-converted-to.pdf, id=1, 346.00266pt x 37.00826pt>
File: tmp1-eps-converted-to.pdf Graphic file (type pdf)

<use tmp1-eps-converted-to.pdf>
Package pdftex.def Info: tmp1-eps-converted-to.pdf used on input line 4.
(pdftex.def)             Requested size: 346.0018pt x 37.00815pt.

as you see, the file was converted. Then I ran pdflatex again:

Package epstopdf Info: Source file: <tmp1.eps>
(epstopdf)                    date: 2011-12-12 13:41:25
(epstopdf)                    size: 15351 bytes
(epstopdf)             Output file: <tmp1-eps-converted-to.pdf>
(epstopdf)                    date: 2011-12-16 14:36:28
(epstopdf)                    size: 7774 bytes
(epstopdf)             Command: <repstopdf --outfile=tmp1-eps-converted-to.pdf 
tmp1.eps>
(epstopdf)             \includegraphics on input line 4.
Package epstopdf Info: Output file is already uptodate.

<tmp1-eps-converted-to.pdf, id=1, 346.00266pt x 37.00826pt>
File: tmp1-eps-converted-to.pdf Graphic file (type pdf)

As you see, no conversion was done.

Then I changed my tmp1.eps and run `pdflatex again. And the log said:

(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package epstopdf Info: Source file: <tmp1.eps>
(epstopdf)                    date: 2011-12-16 14:40:16
(epstopdf)                    size: 620519 bytes
(epstopdf)             Output file: <tmp1-eps-converted-to.pdf>
(epstopdf)                    date: 2011-12-16 14:36:28
(epstopdf)                    size: 7774 bytes
(epstopdf)             Command: <repstopdf --outfile=tmp1-eps-converted-to.pdf 
tmp1.eps>
(epstopdf)             \includegraphics on input line 4.
runsystem(repstopdf --outfile=tmp1-eps-converted-to.pdf tmp1.eps)...executed sa
fely (allowed).

Package epstopdf Info: Result file: <tmp1-eps-converted-to.pdf>
(epstopdf)                    date: 2011-12-16 14:40:21
(epstopdf)                    size: 19423 bytes.

<tmp1-eps-converted-to.pdf, id=1, 241.90375pt x 188.705pt>
File: tmp1-eps-converted-to.pdf Graphic file (type pdf)

<use tmp1-eps-converted-to.pdf>
Package pdftex.def Info: tmp1-eps-converted-to.pdf used on input line 4.
(pdftex.def)             Requested size: 241.90315pt x 188.70453pt.

As you see, now the file was regenerated!

share|improve this answer
    
This approach does not work for me (Miktex 2.9, updated regularly). I get the error message:! LaTeX Error: File `tmp1' not found. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.4 \includegraphics{tmp1} ? –  Per Dec 16 '11 at 20:12
    
Well, you may consider trying TeXLive for Windows... As @Mike-renfro says, it works in Windows TL –  Boris Dec 16 '11 at 20:17
    
Regarding MiKTeX and epstopdf see also this answer of mine: Including pdf figures in Latex document using TexnicCenter. –  Speravir Jan 29 '13 at 3:21
add comment

Regarding your first question: package epstopdf is a good choice when using eps images.

Regarding the second question: there is only a possibility to create no or all images.

share|improve this answer
    
I am afraid you are incorrect wrt second question :( I thought the same, and then run tests. epstopdf is VERY smart :) –  Boris Dec 16 '11 at 19:44
    
I was referring to pst-pdf with the second part. –  Herbert Dec 16 '11 at 20:28
    
Sorry, I misunderstood you... –  Boris Dec 16 '11 at 20:56
    
The problem with epstopdf is that it cannot handle psfrag fragments. –  Per Dec 17 '11 at 11:40
    
@Per auto-pst-pdf can... –  cgnieder Apr 5 '12 at 12:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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