helm-bibtex icon indicating copy to clipboard operation
helm-bibtex copied to clipboard

Trigger bibliography completion list in-situ in TeX source document when typing `\cite{}` command.

Open hongyi-zhao opened this issue 1 year ago • 0 comments

I'm not sure whether it's possible to trigger bibliography completion list in-situ in TeX source document when typing \cite{} command. I noticed some related discussion here:

The documentation of reftex-citation is a bit confusing. It promises completion on known citation keys but I believe "known" refers to keys that have been used previously in this session rather than all keys in the appropriate bibliography. You can use the LaTeX-add-all-bibitems-from-bibtex command defined below to load all keys in your bibliography:

(defun get-bibtex-keys (file)
  (with-current-buffer (find-file-noselect file)
    (mapcar 'car (bibtex-parse-keys))))

(defun LaTeX-add-all-bibitems-from-bibtex ()
  (interactive)
  (mapc 'LaTeX-add-bibitems
        (apply 'append
               (mapcar 'get-bibtex-keys (reftex-get-bibfile-list)))))

Suggestions on appropriate hooks to make this happen automatically are welcome.

But I'm not sure whether helm-bibtex supports a similar feature.

Regards, Zhao

hongyi-zhao avatar May 10 '23 01:05 hongyi-zhao