Org-mode mailing list
 help / color / mirror / Atom feed
From: Timothy <>
Subject: [PATCH] org-cite: define \citeprocitem for LaTeX export
Date: Mon, 23 Aug 2021 18:23:01 +0800
Message-ID: <> (raw)

[-- Attachment #1.1: Type: text/plain, Size: 528 bytes --]

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 <> for more information.

All the best,

[-- Attachment #1.2: Type: text/html, Size: 4006 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-oc-csl-Define-citeprocitem-for-LaTeX-export.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

From 0988d1c331b8872a4c4aa1b1ea40aa2f9f668d17 Mon Sep 17 00:00:00 2001
From: TEC <>
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)
       (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}")))

             reply	other threads:[~2021-08-23 10:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 10:23 Timothy [this message]
2021-08-26  8:18 ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ \
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone