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.

See Final Update below.

I have some images with very long filenames and/or paths, and when I try to include them, my document appears to build fine, but when I try to open the PDF, it says the document is corrupted and when I look at the filesize, it's very small.

If I rename the same image to a very short name, it works fine.

Can anyone tell me the filename length limit for images or input files in general? And is there a way to increase it or do I have to rename all problematic files?

Thanks!

Update 1

For whatever reason, this problem was solved by explicitly adding the extension to the image filename when including it, rather than letting Latex add the filename based on the list of graphics extensions. Not sure why this made a difference, but it's working now.

Update 2

OK, to this problem is.. intermittent?! I first encountered this problem two days ago, and thought I'd solved it with Update 1. Left my thesis alone after a full error-free compile. Today, after making no changes, when I build it, the build finishes fine, although there are some strange warnings, e.g. undefined citations that I know are defined because I see them in my bib file and they've never been an issue before.

However, despite building without errors, when I try to open the PDF, Acrobat says it is corrupted, as per my original question. I also notice the size is not right; my thesis should be around 20MB right now, and when this happens, it's around 17MB.

Curiously though, moving my whole Latex project folder to the root of my hard drive seems to fix it, which gets me back to the question about possible filename length issues. It just seems weird that it would be intermittent; Latex systems may have some problems, but intermittent compile issues when nothing in the source has changed are not a class of problem I've encountered before. Any thoughts?

My thesis is currently about 110 pgs, long bibliography, various lists (notation, figures, TOC, etc). That doesn't seem that crazy to me considering how long some PhD theses are, but is there any possibility I'm running into some sort of output buffer error or something?

Final Update

The intermittent behaviour mentioned above was probably a mistake on my behalf. After a lot of experimenting, I found that simply shortening the paths and image filenames solved my problem.

I did not experiment enough to determine the exact cutoff for length, but the problematic filenames before the switch were up to 141 characters long including the path and extension. After shortening path and filenames, the longest are 105 characters, and everything's building fine now. So, the cutoff for my system must be somewhere in that range.

For reference, I am building using MikTeX 2.8 and TeXnic Center 2 Alpha 3 on Windows 7 x64.

share|improve this question
    
I am not aware of any LaTeX limits, it most likely is an OS limit. Windows I think has a limit of 256 characters in a file name –  Peter Grill Aug 1 '11 at 4:53
1  
Tell us more. Which program on which OS are you using? –  Martin Schröder Aug 1 '11 at 6:50
1  
Doesn't the longer version have some special characters, which are absent in the shorter version? –  eudoxos Aug 1 '11 at 8:08
add comment

1 Answer

up vote 6 down vote accepted

I am not aware of specific restrictions within LaTeX but you would need to be within any limits of your OS or any programs you call (many, for example, do not allow filenames with special characters or spaces).

Depending on the purpose of the documents you create there may be restrictions on the naming of graphic files imposed by a publisher. For example, the AMS requires:

  • File names should be no longer than 20 characters, including an extension.
  • Use only lowercase letters, numbers, a dash, or an underscore in the file names.
  • File names should be specific and descriptive, not generic: smith-fig-3.eps is better than fig3.eps.

(taken from their creating-graphics.pdf)

share|improve this answer
    
As per update to question, the problem was solved by adding the graphics extension. I have no idea why this made a difference. –  SSilk Aug 1 '11 at 16:51
1  
Please ignore previous comment. As per the final update to my post, it was definitely a file-name length problem, and was solved by shortening path-names to my graphics files. Thanks. –  SSilk Aug 10 '11 at 15:23
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.