emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Friendly exchange of thoughts: citations and LaTeX


From: Ihor Radchenko
Subject: Re: Friendly exchange of thoughts: citations and LaTeX
Date: Wed, 29 Mar 2023 14:14:51 +0000

Pedro Andres Aranda Gutierrez <paaguti@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.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@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: 
CAO48Bk_upR4h-xd0YL+FxeKtWvDoqH+Eju6F_Vzds_m6oxBKcg@mail.gmail.com">https://orgmode.org/list/CAO48Bk_upR4h-xd0YL+FxeKtWvDoqH+Eju6F_Vzds_m6oxBKcg@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>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]