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

Undefined reference #923

Open
yashamon opened this issue Sep 4, 2023 · 21 comments · Fixed by #933
Open

Undefined reference #923

yashamon opened this issue Sep 4, 2023 · 21 comments · Fixed by #933
Labels
bug Something isn't working

Comments

@yashamon
Copy link

yashamon commented Sep 4, 2023

This issue appeared recently. Probably last release. All citations are now marked undefined reference. The location of bib is standard: ~/texmf/bibtex/bib
The document compiles without issues with all references intact.

Platform: Win11 release, neovim 9.1

@pfoerster
Copy link
Member

@yashamon Thanks for the report! Does kpsewhich find the bibliography and does texlab (check if texlab reports a document link for the \bibliography/\addbibresource command)? As a test, can you try adding the directory to the BIBINPUTS environment variable, please?

@pfoerster pfoerster added the bug Something isn't working label Sep 10, 2023
@firubat
Copy link

firubat commented Sep 22, 2023

@pfoerster This bug happens to me too. Neovim 0.9.2 on linux mint.
kpsewhich finds the bibliography.
Can you explain how to do the check in texlab?

@yashamon
Copy link
Author

I thought I also replied. In my case kpsewhich also finds the bib file. We are only using the LSP server so I am not sure how to troubleshoot further.

@pfoerster
Copy link
Member

@yashamon @firubat
Can you try triggering a "goto definition" on the \addbibresource or \bibliography command? If it does not open the file, then the server does not find the file.

Can you also try the BIBINPUTS test, please (note that you cannot use ~ inside the variable)?

As a test, can you try adding the directory to the BIBINPUTS environment variable, please?

@firubat
Copy link

firubat commented Sep 23, 2023

@pfoerster So seems that if the bib file is in the same folder as the tex file, it is recognized by texlab. But if the bib file is in a different folder in the BIBINPUTS path (which is the way I like to do it), it is not recognized (the goto definition won't open the file in this case).

@yashamon
Copy link
Author

yashamon commented Sep 23, 2023 via email

pfoerster added a commit that referenced this issue Sep 24, 2023
@pfoerster
Copy link
Member

@yashamon @firubat Can you try b2a49d0, please? With this changeset, the server should be able to find the bibliography.

@naibaf0
Copy link

naibaf0 commented Sep 25, 2023

I have the same error even if the actual scenario seems different and just tried the new commit. It does find a bibliography file in the tex distribution and uses it now, however even in the case where a local file with the same name is present.

in my case I do have a local file bibliography.bib in my project which should be used and when running with this patch, goto definition (of the bibliography) will now offer to go to /usr/share/doc/texlive/bibtex/newcastle-bst/bibliography.bib in addition to my local file. It also offers autocompletion for citations from both files.

So I am guessing there is still some logic missing to prefer a local file over the one from the tex distribution tree.

@firubat
Copy link

firubat commented Sep 25, 2023

Can you try b2a49d0, please?

I must admit that I don't know how to do that, I'm using texlab in neovim via Mason, and I don't know how to tell it to use a specific commit which is outside the releases cycle...

@naibaf0
Copy link

naibaf0 commented Sep 25, 2023

@firubat for me mason saves the binary for texlab in ~/.local/share/nvim/mason/packages/texlab. I think that is the default, but not completely sure.
If you build texlab on the the specified commit locally, you can copy the newly built binary into the location where mason saves it and it will be used in neovim.

@pfoerster
Copy link
Member

@naibaf0 Thanks for trying out the commit.

So I am guessing there is still some logic missing to prefer a local file over the one from the tex distribution tree.

This should be fixed now. I will publish a new release soon.

@firubat
Copy link

firubat commented Nov 8, 2023

Hi @pfoerster , for some reason this is still an issue for me (current version 5.11.0)

@yashamon
Copy link
Author

yashamon commented Nov 8, 2023 via email

@pfoerster pfoerster reopened this Nov 12, 2023
@pfoerster
Copy link
Member

@yashamon

Is it already in the release version?

Yes, this changeset is included with v5.9.0.

@firubat Is the missing bibliography contained in your home directory?

@yashamon
Copy link
Author

yashamon commented Nov 12, 2023 via email

@firubat
Copy link

firubat commented Nov 12, 2023

@pfoerster It's in ~/Dropbox. Which I manually added to the BIBINPUTS variable

@firubat
Copy link

firubat commented Nov 12, 2023

I tried to put it also in /usr/share/texmf and /usr/local/share/texmf but to no avail. Only if it's in the same directory as the tex file.

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))
@Zeta611
Copy link

Zeta611 commented Nov 21, 2023

I have this issue when there are (at least) Korean characters in the path.

I have a .bib file in a local directory where the .tex file lives in.
If the directory contains Korean characters, the LSP shows Undefined reference error, but when I move the directory to a path without Korean characters, the error goes away.

This probably means the directory is not properly handled for CJK characters.

@andrasbarany
Copy link

andrasbarany commented Feb 14, 2024

I am also having this issue with version 5.12.3 in both nvim and nvim-qt. If I copy or link the bibliography file to the local directory, the error disappears. BIBINPUTS is set to the folder containing the .bib file but is apparently ignored.

I'm using my distribution's texlab binary, but changing to the one installed using :LspInstall in nvim doesn't help either.

Here's the output of :LspInfo

 Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: /home/ba/.local/state/nvim/lsp.log
 Detected filetype:   tex
 
 1 client(s) attached to this buffer: 
 
 Client: texlab (id: 1, bufnr: [1])
 	filetypes:       tex, plaintex, bib
 	autostart:       true
 	root directory:  /home/ba
 	cmd:             /usr/bin/texlab
 
 Configured servers list: texlab, marksman

@lucasvreis
Copy link
Contributor

Perhaps it's related to the tilde expansion?

\addbibresource{~/Zotero/bibs/all.bib}

wasn't working for me, but

\addbibresource{/home/lucas/Zotero/bibs/all.bib}

does.

@yashamon
Copy link
Author

yashamon commented Apr 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants