Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paths of bibliography and bibliography styles #493

Open
DrWaleedAYousef opened this issue Oct 5, 2021 · 11 comments
Open

paths of bibliography and bibliography styles #493

DrWaleedAYousef opened this issue Oct 5, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@DrWaleedAYousef
Copy link

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
Copy link
Member

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 pfoerster added the enhancement New feature or request label Oct 9, 2021
@DrWaleedAYousef
Copy link
Author

DrWaleedAYousef commented Oct 15, 2021

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
Copy link
Member

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
Copy link
Author

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
Copy link

JaRoSchm commented Aug 2, 2023

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
Copy link
Member

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

pfoerster added a commit that referenced this issue Aug 5, 2023
@JaRoSchm
Copy link

JaRoSchm commented Aug 6, 2023

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

@JaRoSchm
Copy link

JaRoSchm commented Aug 7, 2023

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
Copy link
Member

pfoerster commented Aug 9, 2023

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
Copy link
Member

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

@JaRoSchm
Copy link

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

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Nov 15, 2023
## [5.11.0] - 2023-11-05

### Added

- Add `texlab.inlayHints.labelDefinitions` and `texlab.inlayHints.labelReferences` options ([#753](latex-lsp/texlab#753))
- Display inlay hints for label references by default ([#753](latex-lsp/texlab#753))

### Fixed

- Moving the build logs to the recycle bin will now clear the diagnostics ([texlab-vscode/#825](latex-lsp/texlab-vscode#825))
- Fix false positive when reporting syntax errors for BibTeX accents ([#945](latex-lsp/texlab#945))

## [5.10.1] - 2023-10-10

### Fixed

- Fix regression when renaming commands ([#936](latex-lsp/texlab#936))

## [5.10.0] - 2023-09-30

### Added

- Allow passing additional arguments to `ChkTeX` using `texlab.chktex.additionalArgs` ([#927](latex-lsp/texlab#927))

### Fixed

- Fix loading bibliographies from `kpathsea` search path ([#923](latex-lsp/texlab#923))
- Don't report duplicate results when using goto definition on includes ([#924](latex-lsp/texlab#924))
- Fix project detection when there exist files with the same name ([#923](latex-lsp/texlab#923))
- Do not report parse errors with `$` in paths ([#931](latex-lsp/texlab#931))

## [5.9.2] - 2023-08-14

### Fixed

- Don't crash when using comments inside `\include`-like commands ([#919](latex-lsp/texlab#919))
- Folding ranges include only the contents instead of the entire range of the structure.
  For example, the folding range of an environment will start after the `\begin` and stop before the `\end`
  ([#915](latex-lsp/texlab#915))

## [5.9.1] - 2023-08-11

### Fixed

- Improve performance when completing BibTeX entries ([#493](latex-lsp/texlab#493))
- Don't report unused entries for very large bibliographies
- Avoid redundant reparses after saving documents

## [5.9.0] - 2023-08-06

### Added

- Use bibliographies found in `BIBINPUTS` environment variable ([#493](latex-lsp/texlab#493))
- Add `texlab.build.pdfDirectory` setting ([#911](latex-lsp/texlab#911))

### Fixed

- Fix search path for aux files when using `\include` instead of `\input` ([#906](latex-lsp/texlab#906))

## [5.8.0] - 2023-07-30

### Added

- Report diagnostics for unused and undefined labels
- Report diagnostics for unused BibTeX entries and undefined citations
- Report diagnostics for duplicate BibTeX entries
- Report diagnostics for duplicate labels
- Add `texlab.build.auxDirectory` and `texlab.build.logDirectory` settings ([#906](latex-lsp/texlab#906))

### Deprecated

- Deprecate `texlab.auxDirectory` in favor of `texlab.build.auxDirectory`

### Fixed

- Fix parsing paths with `|` ([#568](latex-lsp/texlab#568))
- Fix parsing LaTeX identifiers with `=` ([#568](latex-lsp/texlab#568))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants