1

I'm tweaking the import/export code in Zotero for BibTeX/BibLaTeX format, particularly, the file attachment field file. AFAICT, the file field has no proper definition in BibTeX, but BibLaTeX documentation says the following about it:

file: field (verbatim)

A local link to a PDF or other version of the work. Not used by the standard biblio- graphy styles.

and

Verbatim fields are processed in verbatim mode and may contain special characters. Typical examples of verbatim fields are file and doi.

Furthermore, from looking around what's been used in the reference manager field (e.g. JabRef), the file field is used in the following form:

file = {Title:/absolute/or/relative/path/to/file:type}

On Windows, this would look like

file = {Title:C:\absolute\or\relative\path\to\file:type}

However, titles and paths may contain special characters which would be incompatible with the "verbatim" mode of this field, i.e. {} (possibly unbalanced), and characters that, if unescaped, would prevent proper parsing of the field, i.e. : in the Windows example.

So my question is what is the most appropriate way to deal with escaping in these fields?

What I have seen in JabRef, is that the characters are escaped with a backslash, so in the Windows example you get

file = {Title:C\:\\absolute\\or\\relative\\path\\to\\file:type}

That looks reasonable to me, but obviously is not verbatim (I think the BibLaTeX definition, or lack thereof, for verbatim fields is not realistic though). Is anyone aware of issues that this could cause?

Sort of as a side question, if the above escaping is OK, is it also OK to denote backslashes in non-verbatim fields with \\? Or does this mean "forced newline" in BibTeX the same way it does in LaTeX? (IIRC, BibTeX syntax doesn't completely follow LaTeX conventions)

For posterity, I will note that some other characters that are must be escaped in the file field using backslash to avoid compatibility issues are ; and $ (the latter seems to mostly affect Mendeley, since Mendeley escapes the first backslash in a Windows file path with $\backslash$ and converts the rest to forward slashes).

closed as unclear what you're asking by moewe, Mensch, user31729, Malipivo, Adam Liter Jun 22 '14 at 20:12

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    As the documentation says the field is read "verbatim" like e.g. the url field. It shouldn't be necessary to escape anything, only unbalanced braces would be problematic. – Ulrike Fischer May 14 '14 at 16:54
  • Right, shouldn't, but clearly unbalanced braces are an issue, so how does one escape them? And once you escape them, there has to be a way to escape the escape sequence. For a url field, you would url-encode the offending characters. – Aurimas May 14 '14 at 18:10
  • You can probably escape it as you want - but then you will have to redefine the \verb-command used by biblatex so that it handles your escaped brace correctly. – Ulrike Fischer May 14 '14 at 18:49

Browse other questions tagged or ask your own question.