From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6DNWGlx4I2GrtwAAgWs5BA (envelope-from ) for ; Mon, 23 Aug 2021 12:28:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4ILrFVx4I2FUOAAAB5/wlQ (envelope-from ) for ; Mon, 23 Aug 2021 10:28:44 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9CDEA2EA6A for ; Mon, 23 Aug 2021 12:28:43 +0200 (CEST) Received: from localhost ([::1]:57846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mI7C5-0001hj-PU for larch@yhetil.org; Mon, 23 Aug 2021 06:28:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mI7BM-0001hV-JG for emacs-orgmode@gnu.org; Mon, 23 Aug 2021 06:27:56 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:37612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mI7BK-0007pe-Sj for emacs-orgmode@gnu.org; Mon, 23 Aug 2021 06:27:56 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 17so16237309pgp.4 for ; Mon, 23 Aug 2021 03:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:user-agent:message-id:mime-version; bh=utYmuflOCaD403Gxgn4zxHZ25BBcuJrm2GKumWlSVAg=; b=ez/KnUIcQmMR+JinzdJQeAdnHz/ao3qXqe4PbSQCHj/yJdRxm8Qk7hQUP/MiXRA7Zn Jl8dpxZVc+rpvhF0VRAoFSgo6QqXrG9Nkhm1YpN/WH7HO+vnlSe5o6KjPpINgm4swtgi eo8vwxCvttXJTDtTtSQSYWd/erpRLOzfzjL2/o/44Hdte5ETauP6SXU025avy+onhpBu emXZCv2aHhNBK4nhDT/KC5+UThVBOTNXTXjfHqY95WwvEZu0+iFRX1N4JYL0n6HeYKRn 3kmYq+0a1IQQa8RM86RryxT5fa9rK2+G9NKasJsDMRkSgNnUeSOvyVLrbhZ0Yu8xwGG7 b27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:user-agent:message-id :mime-version; bh=utYmuflOCaD403Gxgn4zxHZ25BBcuJrm2GKumWlSVAg=; b=iMbgCEP3+SMhqPbvLPZrBqqkLIkWYPawVE30ovL0+Pa7j0DnwjXGswht3O+KdBHxJ6 +3Inb/RgmfIkwEohLPiii6fwmM48sd7lOE48p39impyN26wo3i+HTSz1+JV+DMWsR6vM r+U2q1XyV2e50N2zoQ9yv+Bx1qOrgp2LXJ1J2WhNwJxCQxtzi7jz4ZpVLPajzvNBjZdn gjKXGT+EQs/fbPmUjA4zPYOb0oggKm1qDAi1gV4mfGdXkMlEB3CEH7nR6MqS7O6pVWB+ aRtXsSIwxTenCCLIiIEAcdDhhn/aZDYQPTctCqZVIo7xoKJEeZ+yWEaoL6qBqaukqVhQ hvwA== X-Gm-Message-State: AOAM530k2BR/GD4FXh+F72oLqMXzrkh6yEPtdx1WtewVo9vjnQDFnlfy a/wKmuJdZNoklMw3/SP4tZbvv3A4zCk= X-Google-Smtp-Source: ABdhPJylC+eUETDz17hRIIOUh9nJBwhvDZHOvTvxEzyANuYO/EURtKeoYWwQKe0U1SAm+lswOwgjjg== X-Received: by 2002:a62:3342:0:b029:3b7:6395:a93 with SMTP id z63-20020a6233420000b02903b763950a93mr32873955pfz.71.1629714472645; Mon, 23 Aug 2021 03:27:52 -0700 (PDT) Received: from localhost (61-245-128-160.3df580.per.nbn.aussiebb.net. [61.245.128.160]) by smtp.gmail.com with ESMTPSA id k22sm15195191pff.154.2021.08.23.03.27.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 03:27:52 -0700 (PDT) From: Timothy To: emacs-orgmode@gnu.org Subject: [PATCH] org-cite: define \citeprocitem for LaTeX export Date: Mon, 23 Aug 2021 18:23:01 +0800 User-agent: mu4e 1.6.1; emacs 28.0.50 Message-ID: <87pmu4tpzv.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=tecosaur@gmail.com; helo=mail-pg1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1629714523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=utYmuflOCaD403Gxgn4zxHZ25BBcuJrm2GKumWlSVAg=; b=WmdRk1h5Mn1USPr7MsyVIMu2ouruCASBrmSMxRC14j8yqU1dF2Ft6kJMWpRgq4qy9pc81o iirhdSBQM8/+3YUqbyOzoJzNMx+QKDhD+jxuSFWyvQSwrWIMSbf2E/1sKxw4cTw2ddRbqi B6L5LdvTFM4LHNQue0GphfkHbFQYcDdraVJk4HJrjsAL30lopOf1cMXpt9uzhcVHDS4Vsn PlhHJ84BPY5p+TmAI0XZ/wkYPLun4AtT/lvRoDa+YosHDR2/rzCFc+CDAK6C3X5q9wc886 zLCGaAnV4rkXh7t7DM7q2S8DOWxmggvcucuQVjEtmoXd/2AJnUd2YtRrKv/l3w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629714523; a=rsa-sha256; cv=none; b=g8KlIm6LYaIsa5d4PIQZTJuWL1+aUVCCwKA0bFF9PVmxBh8uQjWbIdRSh1cGep0lD1CLpO 5huNGOHW48m67aU6einsupBSZ1YD3M1QJ1Iup9b3hB50d1qxU38umUdrIHnGj19q8IU1+l hvq+13jikDj1HaD3AO3VMcokGF1oXea0IAO2ki/1ZHHoc5hj/g6fU4yWSUy/SBD7AhAq+c 1hYAiVifJjO2FzwP6CkRANAzOEl0p7p+7WVVsEgGzKtzVjsSIkLkpIaHticoVNLjCi/t2U mlJkVKCzne8JqeeYCDroLzPkv4QsXL+T5KVpt8IufgmabF/l65JmCAjQV6TvLw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="ez/KnUIc"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.63 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b="ez/KnUIc"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 9CDEA2EA6A X-Spam-Score: -1.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: Q/pKbhbefaJq --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi All, There=E2=80=99s been a discussion over at citeproc-el about how to make hyp= erref treat its references the same way as bib(la)tex references, and to get this to wo= rk we need to add a command definition to the preamble, `\citeprocitem'. =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 \makeatletter =E2=94=82 \newcommand{\citeprocitem}[2]{\hyper@linkstart{cite}{citeproc_bib= _item_#1}#2\hyper@linkend} =E2=94=82 \makeatother =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 See for more info= rmation. All the best, *Timothy* --==-=-= Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =

Hi All,

There=E2=80=99s been a discussion over at citeproc-el about how to make hyp= erref treat its references the same way as bib(la)tex references, and to get this to wo= rk we need to add a command definition to the preamble, \citep= rocitem.

\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

--==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-oc-csl-Define-citeprocitem-for-LaTeX-export.patch >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) (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 --=-=-=--