Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes: > Having said that, I was also (just a bit) bugged by the fact that > bibliography file names are completely expanded when generating LaTeX. > Couldn't we avoid that for LaTeX export?
It is in `org-cite-list-bibliography-files'. AFIAU, full path is forced there to make #+SETUP containing local bibliography path work: ---- main.org ----- #+SETUP: settings.org ------ end -------- ---- ../settings.org ----- #+BIBLIOGRAPHY: local.bib -------------------------- One reasonable option could be keeping relative paths relative iff the #+BIBLIOGRAPHY is derived from a file inside the same directory with the exported file. Tentative patch attached.
>From f068094cc850e7387633bbd57e1c0bfc7e395b21 Mon Sep 17 00:00:00 2001 Message-Id: <f068094cc850e7387633bbd57e1c0bfc7e395b21.1680099269.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Wed, 29 Mar 2023 16:13:29 +0200 Subject: [PATCH] org-cite-list-bibliography-files: Preserve local bibliography path * lisp/oc.el (org-cite-list-bibliography-files): When the bibliography path is relative to the exported file location, keep the path relative. Link: https://orgmode.org/list/cao48bk_upr4h-xd0yl+fxektwvdoqh+eju6f_vzds_m6oxb...@mail.gmail.com --- lisp/oc.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/oc.el b/lisp/oc.el index dde6f3a32..a69165506 100644 --- a/lisp/oc.el +++ b/lisp/oc.el @@ -602,7 +602,12 @@ (defun org-cite-list-bibliography-files () (append (mapcar (lambda (value) (pcase value (`(,f . ,d) - (expand-file-name (org-strip-quotes f) d)))) + ;; Keep the bibliography path relative in + ;; current directory. + (if (equal d default-directory) f + ;; Expand bibliography path for #+SETUP + ;; files located in other directory. + (expand-file-name (org-strip-quotes f) d))))) (pcase (org-collect-keywords '("BIBLIOGRAPHY") nil '("BIBLIOGRAPHY")) (`(("BIBLIOGRAPHY" . ,pairs)) pairs))) -- 2.39.1
-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>