Michael Gerz wrote:
> I found the piece of code below in support/filename.C. I think there is
> something wrong with the logic. If dir.size() already exceeds 160
> character then LyX will not truncate the filename at all! I guess this is
> the case in my case.
You are right. Angus introduced the truncation because of YAP, therefore the
dir name had to be included in the maximum length. We did not know at that
time that pdflatex has a limitation, too. Does the attached patch fix the
problem?
Georg
Index: src/support/filename.C
===================================================================
--- src/support/filename.C (Revision 13371)
+++ src/support/filename.C (Arbeitskopie)
@@ -106,19 +106,21 @@ string const FileName::mangledFilename(s
// (Erring on the side of caution.)
string::size_type max_length = 160;
if (dir.size() - 1 < max_length) {
- // If dir.size() > max_length, all bets are off anyway.
// "+ 1" for the directory separator.
max_length -= dir.size() + 1;
-
- // If the mangled file name is too long, hack it to fit.
- // We know we're guaranteed to have a unique file name because
- // of the counter.
- if (mname.size() > max_length) {
- int const half = (int(max_length) / 2) - 2;
- if (half > 0) {
- mname = mname.substr(0, half) + "___" +
- mname.substr(mname.size() - half);
- }
+ }
+ // If dir.size() > max_length, all bets are off for YAP anyway.
+ // We truncate the filename nevertheless because MiKTeX's
+ // pdflatex can only handle names up to about 200 characters.
+
+ // If the mangled file name is too long, hack it to fit.
+ // We know we're guaranteed to have a unique file name because
+ // of the counter.
+ if (mname.size() > max_length) {
+ int const half = (int(max_length) / 2) - 2;
+ if (half > 0) {
+ mname = mname.substr(0, half) + "___" +
+ mname.substr(mname.size() - half);
}
}