Hi All, There’s been a discussion over at citeproc-el about how to make hyperref treat its references the same way as bib(la)tex references, and to get this to work we need to add a command definition to the preamble, `\citeprocitem'.
┌──── │ \makeatletter │ \newcommand{\citeprocitem}[2]{\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\hyper@linkend} │ \makeatother └──── See <https://github.com/andras-simonyi/citeproc-el/issues/34> for more information. All the best, *Timothy*
>From 0988d1c331b8872a4c4aa1b1ea40aa2f9f668d17 Mon Sep 17 00:00:00 2001 From: TEC <t...@tecosaur.com> Date: Mon, 23 Aug 2021 18:14:05 +0800 Subject: [PATCH 3/4] oc-csl: Define \citeprocitem for LaTeX export * lisp/oc-csl.el (org-cite-csl-finalizer): In order for citeproc-generated references to be treated the same as bib(la)tex references by hyperref, we need to make use of \hyper@linkstart. However, this requires \makeatletter and \makeatother, which can only be used in the preamble. To allow citeproc-el to use \hyper@linkstart, we add a command definition in the preamble, \citeprocitem. --- lisp/oc-csl.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el index 0a057036e..617bddb7e 100644 --- a/lisp/oc-csl.el +++ b/lisp/oc-csl.el @@ -589,6 +589,8 @@ (defun org-cite-csl-finalizer (output _keys _files _style _backend info) (with-temp-buffer (save-excursion (insert output)) (when (search-forward "\\begin{document}" nil t) + ;; Ensure that \citeprocitem is defined for citeproc-el + (insert "\\makeatletter\n\\newcommand{\\citeprocitem}[2]{\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}\n\\makeatother\n\n") ;; Ensure there is a \usepackage{hanging} somewhere or add one. (goto-char (match-beginning 0)) (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}"))) -- 2.32.0