LaTeX epstopdf: how to force conversion each time TeX is compiled

1,238 views
Skip to first unread message

Andy Sayer

unread,
Nov 10, 2010, 5:06:22 PM11/10/10
to LaTeX Users Group
After some years of working with LaTeX on Ubuntu, I'm now doing some
work on a Mac (with which I am not very familiar) and trying to get to
grips with the TeX software on that (I downloaded something called
MacTeX: I think it the program is called TeXShop, and there is also
TeXWorks). One early problem I had was that including .eps files
caused compilation of the .tex to fail, although I found out this can
be stopped by \usepackage{epstopdf}, which converts the .eps files
to .pdf, which does compile.

However, if I change the source .eps file, when I recompile my .tex it
does not run the eps -> pdf converter again unless I delete the
converted .pdf. I don't want to have to manually find and delete
the .pdf each time I edit my .eps as it will get cumbersome when I
have a lot of images. Is there any way to force the eps -> pdf
conversion carried out by this package to run each time the .tex is
compiled? I did not find it in the package options.

Alternatively, is there any way to make .eps files work directly on
the Mac with LaTeX?

Any advice would be welcome. I am not particularly savvy about Macs so
step-by-step instructions would be useful if it's something nontrivial.

Bruno Lopes

unread,
Nov 10, 2010, 5:11:35 PM11/10/10
to latexus...@googlegroups.com
Hi, Andy.

MacTeX is just a TeXLive support to MacOS.  You can use eps files in the same way then in Linux. Try download and use TeXMaker as LaTeX editor. The problem is just the way TeXShop uses the LaTeX compiler.

TeXMaker does not present this problem, but if you want to use TeXShop just compile using the terminal using "latex <file.tex>".

Bests,

Bruno.


--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To post to this group, send email to latexus...@googlegroups.com.
To unsubscribe from this group, send email to latexusersgro...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/latexusersgroup?hl=en.




--
Bruno Lopes Vieira

Linux User #324250
Curriculum Vitae: http://lattes.cnpq.br/7793315334001237
Website: www.tecmf.inf.puc-rio.br/BrunoLopes
--
"Never express yourself more clearly than you are able to think."
(Niels Bohr)

Peter Flynn

unread,
Nov 10, 2010, 6:35:27 PM11/10/10
to latexus...@googlegroups.com
On Wed, Nov 10, 2010 at 10:06 PM, Andy Sayer <iamand...@gmail.com> wrote:
After some years of working with LaTeX on Ubuntu, I'm now doing some
work on a Mac (with which I am not very familiar) and trying to get to
grips with the TeX software on that (I downloaded something called
MacTeX: I think it the program is called TeXShop, and there is also
TeXWorks).

Yes, that is the recommended distribution for the Mac.
 
One early problem I had was that including .eps files caused compilation of the .tex to fail,

MacTeX defaults to PDF, which is the prevailing default on the Mac anyway.
I believe it is possible to make MacTeX create .dvi files, but I'm not sure what use they would be.
 
although I found out this can be stopped by \usepackage{epstopdf}, which converts the .eps files
to .pdf, which does compile.

I haven't ever used it, but if it works, that sounds like one solution.

The other would be to convert all your .eps file to .pdf once and for all, eg with ImageMagick:
$ convert *.eps *.pdf
 
However, if I change the source .eps file,

Ah. These .eps files are being generated from somewhere? Or are you writing them by hand?
 
when I recompile my .tex it does not run the eps -> pdf converter again unless I delete the
converted .pdf.

Correct. It seems that epstopdf only checks for the existence of a matching .pdf file, and doesn't look at the timestamp.
 
I don't want to have to manually find and delete
the .pdf each time I edit my .eps as it will get cumbersome when I
have a lot of images.

Use a script. That's why the Mac is basically just a Linux box underneath.
 
Is there any way to force the eps -> pdf
conversion carried out by this package to run each time the .tex is
compiled? I did not find it in the package options.

I don't think the package can do it because TeX does not have access to the filesystem data like timestamps.
 
Alternatively, is there any way to make .eps files work directly on
the Mac with LaTeX?

Possibly, but I wouldn't.
 
Any advice would be welcome. I am not particularly savvy about Macs so
step-by-step instructions would be useful if it's something nontrivial.

If you're used to Linux then it's just a script, which should work identically on Mac OS X:

#! /bin/bash

for f in `find . -iregex '.*\.\(eps\|pdf\)$' |\
          sort | sed -e "s+\.[ep][pd][sf]$++" | uniq -d | uniq`; do
    LATEST=`ls -1t $f.eps $f.pdf | head -1 | awk -F. '{print $NF}'`
    if [ "$LATEST" = "eps" ]; then
        echo $f.eps is more recent than $f.pdf
#       convert $f.eps $f.pdf
    else
        echo $f.pdf is already up to date
    fi
done


WARNING: untested here because my files go the opposite way to yours: I create .pdf but then convert some to .eps for use with legacy .dvi files :-)  Uncomment the 'convert' line if you're satisfied it is finding all the pairs of files and identifying the most recent .eps where relevant.

///Peter

Bruno Lopes

unread,
Nov 10, 2010, 6:46:54 PM11/10/10
to latexus...@googlegroups.com
Andy,

I've just used TeXShop right now and it worked fine with eps files. It is just set the Typest to LaTeX and click on the button Typeset to compile it. All the eps images are fine in my document.



--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To post to this group, send email to latexus...@googlegroups.com.
To unsubscribe from this group, send email to latexusersgro...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/latexusersgroup?hl=en.

Peter Flynn

unread,
Nov 10, 2010, 6:53:54 PM11/10/10
to latexus...@googlegroups.com
On Wed, Nov 10, 2010 at 11:46 PM, Bruno Lopes <blopes...@gmail.com> wrote:
Andy,

I've just used TeXShop right now and it worked fine with eps files. It is just set the Typest to LaTeX and click on the button Typeset to compile it. All the eps images are fine in my document.

Yes, that's standard in almost all editors now (switch between .dvi ourput and .pdf output).
But if you want PDF output you now need to run dvipdf.

///Peter

Bruno Lopes

unread,
Nov 10, 2010, 7:04:02 PM11/10/10
to latexus...@googlegroups.com
TeXShop now generates both the PDF and DVI file when selected LaTeX typeset.

--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To post to this group, send email to latexus...@googlegroups.com.
To unsubscribe from this group, send email to latexusersgro...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/latexusersgroup?hl=en.

Andy Sayer

unread,
Nov 11, 2010, 9:28:03 AM11/11/10
to LaTeX Users Group

Thanks Bruno and Peter for the ideas: it's a public holiday here today
but I'll try some of these when back at work tomorrow. Bruno, I'll
check which compiler option I was using with TeXShop, as you say it
works for you when LaTeX is selected!

(About my .eps files: I'm writing them from IDL, not by hand. I don't
think IDL can write .pdf directly, or at least, I've not tried.)

Andy

On Nov 10, 8:04 pm, Bruno Lopes <blopesvie...@gmail.com> wrote:
> TeXShop now generates both the PDF and DVI file when selected LaTeX typeset.
>
> On 10 November 2010 21:53, Peter Flynn <anglebrac...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Wed, Nov 10, 2010 at 11:46 PM, Bruno Lopes <blopesvie...@gmail.com>wrote:
>
> >> Andy,
>
> >> I've just used TeXShop right now and it worked fine with eps files. It is
> >> just set the Typest to LaTeX and click on the button Typeset to compile it.
> >> All the eps images are fine in my document.
>
> > Yes, that's standard in almost all editors now (switch between .dvi ourput
> > and .pdf output).
> > But if you want PDF output you now need to run dvipdf.
>
> > ///Peter
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "LaTeX Users Group" group.
> > To post to this group, send email to latexus...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > latexusersgro...@googlegroups.com<latexusersgroup%2Bunsubscribe@ googlegroups.com>
> > .

Andy Sayer

unread,
Nov 12, 2010, 9:25:15 AM11/12/10
to LaTeX Users Group

Ok, some updates from this morning's endeavours.

- I can confirm it's correct that I don't need \usepackage{epstopdf}
when compiling as LaTeX using TeXShop.
- However, when using the TeXShop interface this still does an .eps -
> .pdf conversion of my images, which is not repeated each time
the .tex is compiled (i.e. if the source .eps has changed, it will not
recognise this). So, sadly this does not solve my problem.
- What I can do is invoke latex directly from the command-line (as I
used to on Linux), which is slightly more cumbersome in that it's not
one-click, but at least will incorporate the .eps directly (i.e.
"latex foo.tex latex foo.tex dvips foo.dvi ps2pdf foo.ps"). This may
be the best solution for the moment: now I'm off to find a .ps viewer
for Mac so I don't need to run the final ps2pdf step!

Andy

Peter Flynn

unread,
Nov 12, 2010, 11:17:48 AM11/12/10
to latexus...@googlegroups.com
On Fri, Nov 12, 2010 at 2:25 PM, Andy Sayer <iamand...@gmail.com> wrote:

Ok, some updates from this morning's endeavours

Did you try the script I posted that will update any PDFs for which you have changed the EPS master?

///Peter

Bruno Lopes

unread,
Nov 12, 2010, 12:27:51 PM11/12/10
to latexus...@googlegroups.com
TeXShop creates DVI and PDF files directly. Try, at console, use dvips to generate a Postscript file and after that use ps2pdf to generate a PDF file.

If you need  it directly from the interface, use TeXMaker instead of TeXShop.

Bruno

--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To post to this group, send email to latexus...@googlegroups.com.
To unsubscribe from this group, send email to latexusersgro...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/latexusersgroup?hl=en.

Andy Sayer

unread,
Nov 16, 2010, 9:53:58 AM11/16/10
to LaTeX Users Group

Hi again Peter, Bruno,

In the end following a reboot due to some other system updates, I
noticed that TeXShop now carries out my intended behaviour (i.e. it
*does* regenerate the .pdfs from .eps figures on each compilation).
So, in the end, I did not use the script. Thanks again for both of
your advice--it helped my understanding a lot.

Andy

On Nov 12, 12:27 pm, Bruno Lopes <blopesvie...@gmail.com> wrote:
> TeXShop creates DVI and PDF files directly. Try, at console, use dvips to
> generate a Postscript file and after that use ps2pdf to generate a PDF file.
>
> If you need  it directly from the interface, use TeXMaker instead of
> TeXShop.
>
> Bruno
>
> On 12 November 2010 14:17, Peter Flynn <anglebrac...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Fri, Nov 12, 2010 at 2:25 PM, Andy Sayer <iamandysa...@gmail.com>wrote:
>
> >> Ok, some updates from this morning's endeavours
>
> > Did you try the script I posted that will update any PDFs for which you
> > have changed the EPS master?
>
> > ///Peter
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "LaTeX Users Group" group.
> > To post to this group, send email to latexus...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > latexusersgro...@googlegroups.com<latexusersgroup%2Bunsubscribe@ googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages