0

I cannot get helm-bibtex open pdfs from the helm-bibtex buffer with all bibliography nicely listed in an organized view showing which reference has a pdf or not. I usually get this view by M-x helm-bibtex. On my other linux machine when I hit F1 I can open the selected reference with the pdftools default pdf viewer for emacs (which I very much prefer over evince), but on my current linux machine I cannot do so given that I use the same init.el setup for emacs on both machines via Dropbox.

So this logically means, the problem is with everything except the init.el setup. I am trying to debug this issue, but I need your help to do so.

So currently when I hit F1 a dired view of / will be opened rather than the pdf prpended by its path. I use Zotero with BibTeX Better keys to sync the master bibliography all the time and keep it updated.

.bib file

@article{zwonitzerDigitalPathologyDICOMconform2007,
  title = {Digital Pathology: {{DICOM-conform}} Draft, Testbed, and First Results},
  shorttitle = {Digital Pathology},
  author = {Zw{\"o}nitzer, Ralf and Kalinski, Thomas and Hofmann, Harald and Roessner, Albert and Bernarding, Johannes},
  year = {2007},
  month = sep,
  journal = {Comput Methods Programs Biomed},
  volume = {87},
  number = {3},
  pages = {181--188},
  issn = {0169-2607},
  doi = {10.1016/j.cmpb.2007.05.010},
  abstract = {Hospital information systems ...turncated...systems.},
  keywords = {DICOM,Digital pathology,IHC,Information model,JPEG2000,JPIP,Virtual microscopy},
  file = {/home/me/Documents/Zotero/storage/FKARK43P/Zwönitzer et al. - 2007 - Digital pathology DICOM-conform draft, testbed, a.pdf}
}
 

init.el setup

   (use-package helm-bibtex
      :after helm
      :init
      (setq bibtex-completion-library-path '("~/Zotero/storage"))
      (setq bibtex-completion-bibliography '("~/Dropbox/Gitbooks/manuscript/manuscript.bib")) ;optional
      (setq bibtex-completion-additional-search-fields '(keywords note journal booktitle)) ; additionally search in tags and notes
      (setq bibtex-completion-notes-symbol "✎")         ; bibex-completion-notes-extension is .org
      (setq bibtex-completion-pdf-symbol "⌘")
      (setq bibtex-completion-notes-path "~/Dropbox/RoamNotes/references") ;optional
      (setq org-cite-follow-processor 'helm-bibtex-org-cite-follow)
      (setq bibtex-completion-pdf-field "file")
      (setq bibtex-completion-format-citation-functions
      '((org-mode      . bibtex-completion-format-citation-org-link-to-PDF)
        (latex-mode    . bibtex-completion-format-citation-cite)
        (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc)
        (default       . bibtex-completion-format-citation-default)))
      )
    
    (use-package org-ref
      :defer t
      )

Bug in action enter image description here

edebug-defun

after edebug-defun bibtex-completion-find-pdf-in-field I found out that the function does not return a path to the pdf file as expected but it returns "/". This function resides in bibtex-completion.el file. So the result of the function returns "/" which is an error because the file does exist and its path was like this in the middle results of the function Result: "/home/me/Documents/Zotero/storage/U8R3PPTC/Airold..."

Update: I think I see a bug here at least on this machine

((f-file? value) (list value)) the value has a path in this case, but f-file? returns nil, yes I see an error here. The value showed a path in my minibuffer like this: "/home/me/Documents/Zotero/storage/W7RADZ6V/Abu Al..." but f-file? evaluates to nil. This nil should be t. Right?

So how to fix this from here?

variable

bibtex-completion-pdf-open-function value = find-file

versions

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-02-01

Ubuntu 22.04.1 LTS

doctorate
  • 1,789
  • 16
  • 39

1 Answers1

0

Now I figured out why this issue arises, because I am running helm-bibtex on two different machines whose Zotero paths for pdf files were different, on one was /home/me/Documents/Zotero/storage/... and on the current is /home/me/Zotero/storage/... so this disparity in path led to the problem of not finding the pdf file. I just adapted the path by regex and all works now as expected.

doctorate
  • 1,789
  • 16
  • 39