tecosaur / LaTeX-Utilities

An add-on to LaTeX Workshop that provides some features that go beyond the bare essentials
MIT License
482 stars 29 forks source link

Zotero API Support #4

Closed janosh closed 5 years ago

janosh commented 5 years ago

Feature Request

Is your feature request related to a problem? Please describe.

Importing references in a Zotero library into a .bib file and keeping that up to date is quite the hassle.

Describe the solution you'd like

Zotero offers an API which would allow circumventing the manual .bib file creation entirely and could make references citable as soon as they are added to the Zotero library.

Related issues

tecosaur commented 5 years ago

Waiting for response to https://github.com/bnavetta/vscode-zotero-latex/issues/3

coxackie commented 5 years ago

Giving a thumbs up to this - it would be great!

tecosaur commented 5 years ago

Done in #29

janosh commented 5 years ago

Nice! When's 0.3.0 going to be released? Eager to try it out.

tecosaur commented 5 years ago

As soon as vsce lets me… image

tecosaur commented 5 years ago

@janosh done!

janosh commented 5 years ago

Nice! Really neat UI!

results

For others stumbling across this issue, you need to set

"latex-utilities.zotero.citeMethod": "vscode",

to get the native VS Code citation picker.

There's a slight problem I'm encountering, though. It takes several seconds for results to appear from when I start searching for a citation. When I use the Zotero picker, it's almost instant.

bnavetta commented 5 years ago

Could you check how many search results you're getting in the LaTeX Utilities output panel? It takes a few seconds for me as well when there are lots of results. I think most of the time is spent waiting for the Zotero search API to return, but there might be a better way of searching.

janosh commented 5 years ago

[20:33:22] Got 43 search results from Zotero for "bay"

bnavetta commented 5 years ago

I added some profiling around the search code, and it looks like the API request alone took about 2.5 seconds with 55 results. Looking at the Better BibTeX plugin, it uses Zotero's built-in search plus a search of citation keys. I think any performance improvements would come from changes to the plugin, but I don't know how easy it would be to speed up.

janosh commented 5 years ago

Would it be possible to use the same search algorithm as Zotero's built-in citation picker? I wonder what they do differently that makes them much faster.

slchenchn commented 4 years ago

could somebody tell me how to open the citation picker? Keyboard shortcut or something else?

janosh commented 4 years ago

@yoyoyoohh A little late perhaps but the command your looking for is called "LaTeX Utilities: Cite from Zotero".

Since you're likely going to use that quite often, you'll want to set a keyboard shortcut for it (cmd+k followed by cmd+s). I used cmd+shift+c and set it to only trigger when editorFocus && editorLangId == 'latex'.

zotero-cite-shortcut

As mentioned in the readme under requirements, you'll also need Zotero's Better BibTex extension to be installed and set "latex-utilities.zotero.citeMethod" from "zotero" to "vscode" to get the VS Code UI picker rather than the red BBT one.

VS Code

vscode-picker

BBT

bbt-picker

rubisco57 commented 1 year ago

I am wondering if the automatic updating of the .bib file (see @janosh's initial comment) was addressed, and if so, how the API call to add a cited source to a .bib file may be triggered.

briochemc commented 4 months ago

I am wondering if the automatic updating of the .bib file (see @janosh's initial comment) was addressed, and if so, how the API call to add a cited source to a .bib file may be triggered.

I'd like to know this as well!