Maximum length for BibTex key

When using the [camel] or [title] key patterns for BibTex key creation, long titles result in huge BibTex keys, often exceeding 250 characters. Currently there seems to be no way to limit the length, neither for the whole BibTex key nor for the individual key patterns (none of the key patterns or modifiers would do the job).

This becomes a problem when auto-renaming pdf files based on BibTex keys. As most file systems have strict limits for file / path names, renaming fails or leads to file names that are so long that they might foreseeably create problems when copied to a different folder.

Would it be possible to either
(1) introduce a [camelN] key pattern, shortening the title to the first N characters
(2) provide a modifier for BibTex key patterns to cut to a specified maximum length
(3) offer an option to limit the BibTex key length to a specified number of characters in the “Preferences / BibTex key generator” dialog
or
(4) allow pdf renaming with cutting to a specified character or byte limit (“Quality / Clean up entries)”?

The first three options would result in identical file names and BibTex keys - seems a better solution to me than option 4. But if #4 is easier to implement it would of course do the job just as well. Thank you very much!

1 Like

The issue came up already as part of https://github.com/JabRef/jabref/issues/3582. As of now, it is not possible to limit the length…

Hi,

there is a fixed max length of 255 chars in JabRef for renaming PDFs/Files.
So when you do Cleanup -> Rename files it should be truncated

FileUtil.getValidFileName(targetFileName);

Is this still an issue? Maybe, the RegEx formatter helps? Does JabRef support \1 for back-referencing? Meaning replacing (…255dots…).* by \1