[OS X TeX] graphicx, pdflatex and pdf file names

Chris Goedde cgg.lists at gmail.com
Fri Aug 3 10:34:00 EDT 2007

Hi Ross,

On Aug 2, 2007, at 9:42 PM, Ross Moore wrote:

> It isn't in  graphicx.sty  or  graphics.sty  .
> The coding there simply looks for a file with the given name.
> If not found, it successively *adds* extensions .png  .pdf  .jpg ,  
> in case
> the filename was given without this, and looks for a file with the  
> new name.
> So any filename problems must come from the  pdftex  executable  
> itself...

I guess I'm still a little unclear on this---the whole question is  
what is the "given name" of the file. If I use \includegraphics 
{foo.bar.pdf}, I get a message that extension .bar.pdf is unknown. My  
question is, who is deciding that foo.bar.pdf refers to file foo with  
extension .bar.pdf, not file foo.bar with extension .pdf? Is that  
pdflatex or graphicx? I would guess that pdflatex is just passing the  
whole name to graphics, which is doing the parsing, but maybe  
pdflatex parses out the "name" of the file from the path and the  
extension? Or maybe it just parses out the "name" (including  
extension) from the path? Or neither? Does anyone know the answer to  

> Maybe you meant     sprintf('foo-%2f.pdf', variable_name)
> with   variable_name   referring to a number ?
> Then you need to change this to a string and alter it before  
> printing the string.

If variable_name is a float and you want a string with a certain  
number of digits to the right of the decimal, then the syntax is  
%.nf, where n is the number of digits. (The format %nf specifies that  
the minimum number of digits total is n.) The . comes along for free  
(since the string represents a number) and would have to be munged  
afterward. This all comes from ansi c, which Matlab emulates.

> But it is not your choice what your collaborators work with,
> or the publishers of the books that you write.

But there's a big difference in what I do in my daily workflow and  
what I send to a publisher. Once I have everything ready to send off,  
I usually rename the pdfs to something like Fig1a.pdf, Fig2b.pdf,  
etc. anyway, to help the publishers out a bit. But that's different  
from having to rename files on an ongoing basis while I'm working on  
drafts, sorting out axis bounds and plot aspect ratios, etc. I'm more  
than willing to do one-time adjustments to satisfy publisher  
requirements, I just don't want to build my entire workflow around  
them if there's no need.

Obviously, this isn't the biggest issue, and there's an easy  
workaround, so my original problem is solved. But I can't imagine  
that anyone thinks that a user with a file named foo.bar.pdf is  
trying to indicate that the extension of the file is  
actually .bar.pdf. So software that produces that result seems  
obviously broken and ought to be fixed. That there are other programs  
that share this same flaw or other operating systems that can't  
handle files with more than one . in the name is a total red herring,  


------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

More information about the MacOSX-TeX mailing list