texlab icon indicating copy to clipboard operation
texlab copied to clipboard

paths of bibliography and bibliography styles

Open DrWaleedAYousef opened this issue 3 years ago • 11 comments

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.

DrWaleedAYousef avatar Oct 05 '21 15:10 DrWaleedAYousef

Thanks for the report.

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

  • First, it tries to find the referenced file inside the current workspace. The workspace is basically a dependency graph of all user-defined files. To find the root file, texlab walks up the directory tree until it finds a TeX file with a document environment. The child files are found using the location of the parent file, the working directory, the optional "root directory" setting and the optional "aux directory" setting.
  • If texlab does not find a suitable file in the workspace, then it looks for a file that is part of the TeX distro. It does so by parsing the kpsewhich database (the ls-R files in texlive). Generally, executing kpsewhich somefile.tex should yield the same result. For packages and classes, texlab does not consult kpsewhich for performance reasons. Instead, it has a custom built cache that contains the exposed commands and environments for each package and document class.

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.

pfoerster avatar Oct 09 '21 17:10 pfoerster

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

DrWaleedAYousef avatar Oct 15 '21 00:10 DrWaleedAYousef

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?

pfoerster avatar Oct 20 '21 16:10 pfoerster

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

DrWaleedAYousef avatar Oct 20 '21 22:10 DrWaleedAYousef

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.

JaRoSchm avatar Aug 02 '23 08:08 JaRoSchm

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

pfoerster avatar Aug 05 '23 20:08 pfoerster

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

JaRoSchm avatar Aug 06 '23 07:08 JaRoSchm

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?

JaRoSchm avatar Aug 07 '23 10:08 JaRoSchm

Would this also be possible to implement here?

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

  • Unnecessary reparses when editing those files due to duplicate file watcher events (can be fixed with a debouncer)
  • Checking for diagnostics can be slow if there are too many errors/warnings in the file (can be fixed by limiting the number of reported errors (easy fix)
  • Filtering the completion items is very slow (switching to fst for the filtering should help here). Caching the items is not the issue here (this is already done).

I am currently working on this issue.

pfoerster avatar Aug 09 '23 18:08 pfoerster

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

pfoerster avatar Aug 10 '23 20:08 pfoerster

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

JaRoSchm avatar Aug 11 '23 12:08 JaRoSchm