latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.56k stars 53 forks source link

paths of bibliography and bibliography styles #493

Open DrWaleedAYousef opened 3 years ago

DrWaleedAYousef commented 3 years ago

image

How can I set the path of the bibliography and bibliography styles to be searched by texlab. More specifically, when I go with the cursor under each of the bibliography file and hit M-enter in emacs, texlab opens the underlying file. How does it know about the path? It seems that texlab searches in the path texlive/2021/texmf-dist/doc/latex/translation-europecv-de/templates and give it a higher priority.

Also, texlab does not suggest bibliography style files nor bring a documentation for it.

pfoerster commented 3 years ago

Thanks for the report.

texlab uses the following mechanism to resolve paths when including files:

Concerning bibliography styles: currently, texlab does not provide completion for those but it should not be too complicated to add them to the completion and the hover requests.

DrWaleedAYousef commented 3 years ago

Thanks for detailed reply. I think there is some ambiguty in the way that texlab populates these file names. For instance, I have defined this directory ~/texmf to follow the same latex tree. Under this folder, I put my bib files, exactly here: ~/texmf/bibtex/bib/base. This later folder includes the following bib files booksIhave, AAtmpAA, NewPublications, Books (all with extension bib). However, only the first two are recognized by texlab (so that when I click M-enter underneath it opens them). Please, see the attached snap for visual interpretation. image

pfoerster commented 3 years ago

Do you have the files mentioned listed in the kpsewhich database? What happens if you call kpsewhich NewPublications.bib? Does it output the correct path? Where do you have your TeX file located? Is it part of the same directory tree or somewhere else?

DrWaleedAYousef commented 3 years ago

The kpsewhich when applied to each of these files, gives the correct path of each of them. The tex file is not located in the same directory tree (/texmf/bibtex/bib/base) as the four bib files. It is located in ~/Downloads/SomeFolder

JaRoSchm commented 1 year ago

Hi, is there some solution for this issue? I have the same problem that I have a folder with many bib files while the tex files are at a different location. kpsewhich is able to detect them as I put the bibtex folder into the BIBINPUTS variable in my .zshrc. The vimtex plugin is also able to find them. Only texlab shows Error:11:Undefined reference all over the place.

pfoerster commented 1 year ago

@JaRoSchm With #912, texlab will now load the bibliographies from the BIBINPUTS environment variable.

JaRoSchm commented 1 year ago

Thank your very much! From my point of view this could be closed. However, I don’t really now about the original issue.

JaRoSchm commented 1 year ago

I tried the new version today and it works indeed. However, I didn't mention that the bib files in this folder contain around 20000 items as it is shared by a group of people. This slows down texlab extremely. The completion using vimtex works much faster after the second completion as they are using some kind of caching of bibtex items. Would this also be possible to implement here?

pfoerster commented 1 year ago

Would this also be possible to implement here?

@JaRoSchm Thanks for testing it out! Large bibliographies currently have the following problems:

I am currently working on this issue.

pfoerster commented 1 year ago

@JaRoSchm Can you try out #917, please? It should speed up completion by a lot.

JaRoSchm commented 1 year ago

@pfoerster I just tried it and this actually improved the performance such that there is no noticeable delay anymore. Thank you very much!