LaTeXTools icon indicating copy to clipboard operation
LaTeXTools copied to clipboard

Autocompletion for BibTeX entries not stripping line breaks in BibTeX fields such as "author"

Open t-jager opened this issue 3 years ago • 2 comments

In my user LaTeXTools.sublime-settings file I have set

"cite_panel_format": ["{keyword}: {author} - {title} ({year})",""],

and

"cite_autocomplete_format": "{keyword}: {author} - {title} ({year})",

When entering \cite{, then the auto completion menu is triggered. However, only the first author is shown (plus the word "and" that separates multiple authors), and one can only search for the first author's name.

Here is an example:

screenshot

It seems to be an issue with a certain set of BibTeX files that are not parsed correctly. Concretely, with the BibTeX files from here

https://cryptobib.di.ens.fr/

I can reproduce the issue reliably (it yields the above screenshot).

However, when I use BibTeX entries from DBLP, which does not use line breaks in the author field, then it works fine:

DBLP

My best guess for the root of this issue is that the files from https://cryptobib.di.ens.fr/ contain a line break after each "and" between authors, like this:

author = "Yan Huang and Fangguo Zhang and Zhi Hu and Zhijie Liu",

And it seems that LaTeXTools does not strip these line breaks, but stops reading the field after the first line break. In contrast, DBLP BibTeX entries don’t contain line breaks and work fine.

Since BibTeX allows for line breaks in the authors field, it seems that LaTeXTools does not yet parse these fields correctly, as it seems to stop reading the contents of the field at a line break.

t-jager avatar May 19 '22 14:05 t-jager

UPDATE:

Indeed, the root of the issue is that LaTeXTools (or maybe the underlying BibTeX parser, which seems to be external?) stops reading an author field at the first line break.

t-jager avatar May 21 '22 08:05 t-jager

UPDATE 2:

The issue seems not to appear on Windows. However, I can reliably reproduce it with Sublime Text Build 4126, Stable Channel, with recent installs of LaTeXTools and LaTeXYZ, running on MacOS 12.3.1 Monterey.

t-jager avatar May 31 '22 08:05 t-jager