From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AK7bKiY1/mOtjQAAbAwnHQ (envelope-from ) for ; Tue, 28 Feb 2023 18:08:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id YBZFKyY1/mPelgAA9RJhRA (envelope-from ) for ; Tue, 28 Feb 2023 18:08:54 +0100 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 C01B323926 for ; Tue, 28 Feb 2023 18:08:53 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pX3SK-0000w7-CJ; Tue, 28 Feb 2023 12:08:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pX3SH-0000vi-3x for emacs-orgmode@gnu.org; Tue, 28 Feb 2023 12:07:57 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pX3SD-00032S-Tz for emacs-orgmode@gnu.org; Tue, 28 Feb 2023 12:07:56 -0500 Received: by mail-wm1-x335.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso4670075wmo.0 for ; Tue, 28 Feb 2023 09:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew.cmu.edu; s=google-2021; t=1677604066; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Qyc8pdu2lnaZnrZUIhaQvsqmz9FvJhGYnDjWeFcrE1k=; b=GZo9/UUtvfdUxRLQvSX0FvqC7HwaqtuKdZXiuSXnQ/WIFCGXXQzCM6FQSKlAcuGz6x NmwCUWOV2V+8B+WaQlAWToqigJXFLymbCSpy8VSk3zFi6emdghTVhNPda8WgDL5Qtyj+ yfBvgSQWcAv8gO+8mN3EQkf6my4zyDYFwosSzC+6XQ07vlcs9zgFnT/zgOkjvCiZNJ03 uvj+gDNCNNURVgshEvPJOm+nX/J3HqzNwE9Yg1+w3/7RNjIK3TfWQ+LFu1qd3xGdvJqh QK2kQtiojlJE/VuVp/WAYVfZjeqy3YqdSDLLoDeuds6cL0WYo9rpRfXdQhoA5L4xnhOU eUeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677604066; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qyc8pdu2lnaZnrZUIhaQvsqmz9FvJhGYnDjWeFcrE1k=; b=keeWnYxgqFgKbeQaD7r/N9hKHHuhegNSgZ6OPrNkXT/iioa5121OWBajQ03d+U/zZP NW3Hrp2p1TaAd9Md4e33kIUT0t59rVEZ1dnOBFguYiZTP8WmQWwhipjOiyLqOACKMrqq ToWLxYNSFPFsu4sF/mpcCnaKf9wVmpNJXcPqlX+0IulauiFWSWBZNhOVkpcX+W97trwU 1gbOFuP9L5bpWIShA2Fpkg7S9pc7nGBGEAjcdDkyrYslYkWkaket29NGu9/T8YeJ7ZMx hpHPvGFK8n6HKDduIxfaldFW436sC1LhlcgyNzk6SoS+XN3OwFg7HdfPoOV3Cwy0ykm+ ZCyQ== X-Gm-Message-State: AO0yUKXyZ9jpKWS8pXpQMEYQIT3lxwfaEsT7MIhfX0lmob1Qld53QRA9 ucI2e3QzkIlvKWmGDYVG7fe4gy12lbXqoBKVq+EqvQ== X-Google-Smtp-Source: AK7set+M7vpJm2pqXqlJjVidG/ReMtYMQUXiy92rlIluIvmdNIoXlSI+wBh9hbT7lg1q7jUPdWwtQ4GptMDuGYvG+OQ= X-Received: by 2002:a05:600c:a383:b0:3e0:111:28a8 with SMTP id hn3-20020a05600ca38300b003e0011128a8mr1008147wmb.0.1677604066150; Tue, 28 Feb 2023 09:07:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Kitchin Date: Tue, 28 Feb 2023 12:07:35 -0500 Message-ID: Subject: Re: How to produce an org-ref citation from ivy-bibtex To: Sven Bretfeld Cc: Emacs Orgmode Content-Type: multipart/alternative; boundary="0000000000006fdb9805f5c5a2e2" Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=jkitchin@andrew.cmu.edu; helo=mail-wm1-x335.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677604134; a=rsa-sha256; cv=none; b=rJhnvT7MOn0Cst/UHEB2kd7F0gD4GKWRfc3/HQ7jLXZ1B6qYd6TaerkJ0o29rs2tQiiAhp Zg+B61T1+VEkMImnCrx+A7TeB6VpQTjEmS8CfF00Zsx1SJh+EEZnLWQqYKHftoZOMIN10v XIuP1thcbfDKJC7YQxH8JdWDuAaBT8X3HdxoQHRWXiBta77RAjkjjWCPdmkddrGAam0Qfh /N06v5bGrWUuBvb2M3sP7NGnI2+0Uzhp4u1z6A17TQHfhP6Jsr1XS83JSQCZdhG9MgfdCU lpxAn5b3cm1DToTsTipeaV8t55U1P9UvgHszPpmWGt/E1VJearU+dlNOlTg0qA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b="GZo9/UUt"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=andrew.cmu.edu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677604134; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Qyc8pdu2lnaZnrZUIhaQvsqmz9FvJhGYnDjWeFcrE1k=; b=lFoKxvtOj61g6OeoHl8uUTO3VF6KRV7xODiULFxWTwxxkHf7yZqy7LxX6uWQ0GJJWp8GF7 RO5IzeSHpDu01OrN9nM0wF7d+QmH7/ajfGNtzPJLpvM+AvCxnNbsX6SBw5iO1/cxiKDNjI Yemp22p4Ltfxqz42ohnN2Uxn7N9GzdObCNUNwnCd67D9ajh8GMWaDtk0yPpYTeWj1FdIpM E2GUpPMhmtTMDeuqKTBnU061iFZkUztWUOYHs50zWt7IVCEwKuwylo2B7fOGgQDdQBBwZq eorVMGGrJj+ydsCMR5W50+a4lUPUuHZR19qY1ruRi1atcdH+0xscUBuYL5D61g== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -7.44 X-Spam-Score: -7.44 X-Migadu-Queue-Id: C01B323926 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew.cmu.edu header.s=google-2021 header.b="GZo9/UUt"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=andrew.cmu.edu X-TUID: clxCSU0ARM+j --0000000000006fdb9805f5c5a2e2 Content-Type: text/plain; charset="UTF-8" You can try something like this #+BEGIN_SRC emacs-lisp (setq bibtex-completion-format-citation-functions '((org-mode . (lambda (keys) (org-ref-insert-cite-keys keys) "")) (latex-mode . bibtex-completion-format-citation-cite) (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc) (default . bibtex-completion-format-citation-default))) #+END_SRC it seems like ivy-bibtex at least expects some kind of string to be returned, but org-ref-insert-cite-keys does the insertion for you. On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld wrote: > Hi everybody > > Is it at all possible to produce a correct org-ref citation format > from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by > "correct" is the format: [[cite:&citekey]]. > > The problem seems to come down to the question what has to be inserted > in the 2nd line here: > > (setq bibtex-completion-format-citation-functions > '((org-mode . ??????) > (latex-mode . bibtex-completion-format-citation-cite) > (markdown-mode . bibtex-completion-format-citation-pandoc-citeproc) > (default . bibtex-completion-format-citation-default))) > > (A) Not setting the variable at all, defaults to producing an ebib > link which is of no use to me at all. > > (B) Putting org-ref-helm-bibtex-insert-citation here (as found on > reddit) does not work, since the function does not seem to exist > anymore. > > (C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing > that from the list of ivy-bibtex-actions, just calls the function > interactively, you have to search for the bib-entry again and the > resulting link looks like: [[cite:&citekey]]^&. The terminating '^&' > obviously makes subsequent LaTeX-exports fall. > > (D) Putting "bibtex-completion-format-citation-org-cite" here, > produces standard org-links: [cite:@citekey]. These are not correctly > exported to a tex file when the org-ref package is loaded. > > The only working solution I have found is to use org-ref's own cite > function org-ref-insert-cite-link. I know that ivy-bibtex can be set > as backend (require 'org-ref-ivy). But in this way ivy-bibtex's other > actions (like opening an associated PDF or note file) are lost. > > It would be nice to be able to use a SINGLE key-binding to select a > bib-entry and then decide what to do with it (insert org reference, > insert tex reference, open pdf, etc.). This was possible earlier (I > did that for years with older versions of org-ref-helm) but is > apparently no longer possible now. > > Many thanks for help and suggestions, > > Sven > > --0000000000006fdb9805f5c5a2e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You can try something like=C2=A0this

#+= BEGIN_SRC emacs-lisp
(setq bibtex-completion-format-citation-functions=C2=A0 =C2=A0 =C2=A0 '((org-mode =C2=A0 =C2=A0 =C2=A0. (lambda (keys)= (org-ref-insert-cite-keys keys) ""))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 (latex-mode =C2=A0 =C2=A0. bibtex-completion-format-citation-cite)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (markdown-mode . bibtex-completion-format-citat= ion-pandoc-citeproc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (default =C2=A0 =C2=A0 = =C2=A0 . bibtex-completion-format-citation-default)))
#+END_SRC

it seems like ivy-bibtex at least expects some kind of= string to be returned, but org-ref-insert-cite-keys does the insertion for= you.

On Sun, Feb 26, 2023 at 11:19 AM Sven Bretfeld <sven.bretfeld@ntnu.no> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">Hi everybody

Is it at all possible to produce a correct org-ref citation format
from ivy-bibtex (or helm-bibtex, I tried both)? What I mean by
"correct" is the format: [[cite:&citekey]].

The problem seems to come down to the question what has to be inserted
in the 2nd line here:

(setq bibtex-completion-format-citation-functions
=C2=A0 =C2=A0 =C2=A0 '((org-mode=C2=A0 =C2=A0 =C2=A0 . ??????)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (latex-mode=C2=A0 =C2=A0 . bibtex-completion-fo= rmat-citation-cite)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (markdown-mode . bibtex-completion-format-citat= ion-pandoc-citeproc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (default=C2=A0 =C2=A0 =C2=A0 =C2=A0. bibtex-com= pletion-format-citation-default)))

(A) Not setting the variable at all, defaults to producing an ebib
link which is of no use to me at all.

(B) Putting org-ref-helm-bibtex-insert-citation here (as found on
reddit) does not work, since the function does not seem to exist
anymore.

(C) Putting org-ref-insert-cite-link here is obviously wrong. Choosing
that from the list of ivy-bibtex-actions, just calls the function
interactively, you have to search for the bib-entry again and the
resulting link looks like: [[cite:&citekey]]^&. The terminating = 9;^&'
obviously makes subsequent LaTeX-exports fall.

(D) Putting "bibtex-completion-format-citation-org-cite" here, produces standard org-links: [cite:@citekey]. These are not correctly
exported to a tex file when the org-ref package is loaded.

The only working solution I have found is to use org-ref's own cite
function org-ref-insert-cite-link. I know that ivy-bibtex can be set
as backend (require 'org-ref-ivy). But in this way ivy-bibtex's oth= er
actions (like opening an associated PDF or note file) are lost.

It would be nice to be able to use a SINGLE key-binding to select a
bib-entry and then decide what to do with it (insert org reference,
insert tex reference, open pdf, etc.). This was possible earlier (I
did that for years with older versions of org-ref-helm) but is
apparently no longer possible now.

Many thanks for help and suggestions,

Sven

--0000000000006fdb9805f5c5a2e2--