all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] oc-csl: Add support for nocite citations
@ 2022-07-01  9:30 András Simonyi
  2022-07-02  4:38 ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: András Simonyi @ 2022-07-01  9:30 UTC (permalink / raw)
  To: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

Dear All,

the attached patch adds support for nocite citations in the csl
org-cite export processor, including support for using the special key
"*" to include all entries in the bibliography.


best wishes,
András

[-- Attachment #2: 0001-oc-csl.el-Add-support-for-nocite-citations.patch --]
[-- Type: text/x-patch, Size: 5665 bytes --]

From 3e6514d2e2f4fa68462a02578880b126e3116739 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A1s=20Simonyi?= <andras.simonyi@gmail.com>
Date: Fri, 1 Jul 2022 10:24:17 +0200
Subject: [PATCH] oc-csl.el: Add support for nocite citations

* lisp/oc-csl.el (org-cite-csl--rendered-citations): Collect nocite
style citations in a separate list as required by the citeproc-el
API. Set the output of all nocite citations to the empty string.
(org-cite-csl--nocite-p): New helper predicate for checking whether a
citation is a nocite.
---
 etc/ORG-NEWS   |  5 +++++
 lisp/oc-csl.el | 53 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 902d70256..0f7a9e825 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -239,7 +239,12 @@ This behaviour can be changed by supplying a =:align= parameter.
 
 The tabbing environment can be useful when generating simple tables which
 can be span multiple pages and when table cells are allowed to overflow.
+*** Support for nocite citations in the csl export processor
 
+The csl citation export processor now supports `nocite' style
+citations that add items to the printed bibliography without visible
+references in the text. Using the key `*' in a nocite citation
+includes all available items in the printed bibliography.
 ** New functions and changes in function arguments
 
 *** New function ~org-element-cache-map~ for quick mapping across Org elements
diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index eb67092dd..05e4fa976 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -59,9 +59,13 @@
 ;; - author (a), including bare (b), caps (c), bare-caps (bc), full (f),
 ;;   caps-full (cf), and bare-caps-full (bcf) variants,
 ;; - noauthor (na), including bare (b), caps (c) and bare-caps (bc) variants,
+;; - nocite (n),
 ;; - year (y), including a bare (b) variant,
 ;; - text (t). including caps (c), full (f), and caps-full (cf) variants,
 ;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
+;;
+;; Using "*" as a key in a nocite citation includes all available items in
+;; the printed bibliography.
 
 ;; CSL styles recognize "locator" in citation references' suffix.  For example,
 ;; in the citation
@@ -103,6 +107,7 @@
 (declare-function citeproc-create "ext:citeproc")
 (declare-function citeproc-citation-create "ext:citeproc")
 (declare-function citeproc-append-citations "ext:citeproc")
+(declare-function citeproc-add-uncited "ext:citeproc")
 (declare-function citeproc-render-citations "ext:citeproc")
 (declare-function citeproc-render-bib "ext:citeproc")
 (declare-function citeproc-hash-itemgetter-from-any "ext:citeproc")
@@ -296,6 +301,12 @@ INFO is the export state, as a property list."
    (citeproc-proc-style
     (org-cite-csl--processor info))))
 
+(defun org-cite-csl--nocite-p (citation info)
+  "Non-nil when CITATION object's style is nocite.
+INFO is the export state, as a property list."
+  (when-let ((style (car (org-cite-citation-style citation info))))
+    (or (string= style "nocite") (string= style "n"))))
+
 (defun org-cite-csl--create-structure-params (citation info)
   "Return citeproc structure creation params for CITATION object.
 STYLE is the citation style, as a string or nil. INFO is the export state, as
@@ -535,20 +546,31 @@ INFO is the export state, as a property list.
 Return an alist (CITATION . OUTPUT) where CITATION object has been rendered as
 OUTPUT using Citeproc."
   (or (plist-get info :cite-citeproc-rendered-citations)
-      (let* ((citations (org-cite-list-citations info))
-             (processor (org-cite-csl--processor info))
-             (structures
-              (mapcar (lambda (c) (org-cite-csl--create-structure c info))
-                      citations)))
-        (citeproc-append-citations structures processor)
-        (let* ((rendered
-                (citeproc-render-citations
-                 processor
-                 (org-cite-csl--output-format info)
-                 (org-cite-csl--no-citelinks-p info)))
-               (result (seq-mapn #'cons citations rendered)))
-          (plist-put info :cite-citeproc-rendered-citations result)
-          result))))
+      (let ((citations (org-cite-list-citations info))
+	    (processor (org-cite-csl--processor info))
+	    normal-citations nocite-ids)
+	(dolist (citation citations)
+	  (if (org-cite-csl--nocite-p citation info)
+	      (setq nocite-ids (append (org-cite-get-references citation t) nocite-ids))
+	    (push citation normal-citations)))
+	(let ((structures
+	       (mapcar (lambda (c) (org-cite-csl--create-structure c info))
+		       (nreverse normal-citations))))
+	  (citeproc-append-citations structures processor))
+	(when nocite-ids
+	  (citeproc-add-uncited nocite-ids processor))
+	(let (result
+	      (rendered (citeproc-render-citations
+			 processor
+			 (org-cite-csl--output-format info)
+			 (org-cite-csl--no-citelinks-p info))))
+	  (dolist (citation citations)
+	    (push (cons citation
+			(if (org-cite-csl--nocite-p citation info) "" (pop rendered)))
+		  result))
+	  (setq result (nreverse result))
+	  (plist-put info :cite-citeproc-rendered-citations result)
+	  result))))
 
 \f
 ;;; Export capability
@@ -638,7 +660,8 @@ property list."
     (("noauthor" "na") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
     (("year" "y") ("bare" "b"))
     (("text" "t") ("caps" "c") ("full" "f") ("caps-full" "cf"))
-    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))))
+    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
+    (("nocite" "n"))))
 
 (provide 'oc-csl)
 ;;; oc-csl.el ends here
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-01  9:30 [PATCH] oc-csl: Add support for nocite citations András Simonyi
@ 2022-07-02  4:38 ` Ihor Radchenko
  2022-07-02  8:32   ` András Simonyi
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-02  4:38 UTC (permalink / raw)
  To: András Simonyi; +Cc: emacs-orgmode list

András Simonyi <andras.simonyi@gmail.com> writes:

> the attached patch adds support for nocite citations in the csl
> org-cite export processor, including support for using the special key
> "*" to include all entries in the bibliography.

Thanks!
By "*", do you mean something like [cite/n:@*]?
If so, will it be correctly fontified as an existing citation?

> +*** Support for nocite citations in the csl export processor
>  
> +The csl citation export processor now supports `nocite' style
> +citations that add items to the printed bibliography without visible
> +references in the text. Using the key `*' in a nocite citation
> +includes all available items in the printed bibliography.

It would help to provide an example how to use "*" key.
Also, I'd prefer if you follow doc/Documentation_Standards.org. Please
use Org markup instead of `...' quotes.

> +(defun org-cite-csl--nocite-p (citation info)
> +  "Non-nil when CITATION object's style is nocite.
> +INFO is the export state, as a property list."
> +  (when-let ((style (car (org-cite-citation-style citation info))))
> +    (or (string= style "nocite") (string= style "n"))))

Why not simply
(member (car (org-cite-citation-style citation info)) '("nocite" "n"))
?

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-02  4:38 ` Ihor Radchenko
@ 2022-07-02  8:32   ` András Simonyi
  2022-07-03 11:58     ` Ihor Radchenko
  2022-07-04 11:54     ` [PATCH] oc-csl: Add support for nocite citations Ihor Radchenko
  0 siblings, 2 replies; 18+ messages in thread
From: András Simonyi @ 2022-07-02  8:32 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

Dear Ihor,

thanks a lot for your reply!

On Sat, 2 Jul 2022 at 06:37, Ihor Radchenko <yantar92@gmail.com> wrote:

> By "*", do you mean something like [cite/n:@*]?
> If so, will it be correctly fontified as an existing citation?

Yes I meant exactly that. As for fontification, this is a very good
question! I've checked it now with the built-in "basic"
activation processor and it shows the "*" with an "error" face,
indicating that it's not a key in the bibliography file(s), which
might not be ideal. Nonetheless, this problem is not limited to or
introduced by this patch, because the same construct and
functionality is also supported by the "biblatex" and "natbib" export
processors.  Actually, the possibility of using "*" as a key comes
simply
from a citeproc-el change, not from oc-csl, I just thought that it is
obscure enough to merit an explicit mention in the NEWS file.

> It would help to provide an example how to use "*" key.
> Also, I'd prefer if you follow doc/Documentation_Standards.org. Please
> use Org markup instead of `...' quotes.

Thanks, I have tried to address your comments in the attached new
version of the patch.
Note that the quotes around "csl" follow the manual's "Citation
handling" chapter.

> Why not simply
> (member (car (org-cite-citation-style citation info)) '("nocite" "n"))
> ?

Thanks, that is indeed simpler, I've changed the function's definition
accordingly.


best wishes,
András

[-- Attachment #2: 0001-oc-csl.el-Add-support-for-nocite-citations.patch --]
[-- Type: text/x-patch, Size: 5698 bytes --]

From 7d2c6be97258ecbca4929e302d63b760bec078ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A1s=20Simonyi?= <andras.simonyi@gmail.com>
Date: Fri, 1 Jul 2022 10:24:17 +0200
Subject: [PATCH] oc-csl.el: Add support for nocite citations

* lisp/oc-csl.el (org-cite-csl--rendered-citations): Collect nocite
style citations in a separate list as required by the citeproc-el
API. Set the output of all nocite citations to the empty string.
(org-cite-csl--nocite-p): New helper predicate for checking whether a
citation is a nocite.
---
 etc/ORG-NEWS   | 11 +++++++++++
 lisp/oc-csl.el | 53 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 49 insertions(+), 15 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 902d70256..4cda357f1 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -239,7 +239,18 @@ This behaviour can be changed by supplying a =:align= parameter.
 
 The tabbing environment can be useful when generating simple tables which
 can be span multiple pages and when table cells are allowed to overflow.
+*** Support for =nocite= citations in the "csl" export processor
 
+The "csl" citation export processor now supports =nocite= style
+citations that add items to the printed bibliography without visible
+references in the text. Using the key =*= in a nocite citation, for
+instance,
+
+#+begin_src org
+[cite/n:@*]
+#+end_src
+
+includes all available items in the printed bibliography.
 ** New functions and changes in function arguments
 
 *** New function ~org-element-cache-map~ for quick mapping across Org elements
diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index eb67092dd..a2bd6653c 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -59,9 +59,13 @@
 ;; - author (a), including bare (b), caps (c), bare-caps (bc), full (f),
 ;;   caps-full (cf), and bare-caps-full (bcf) variants,
 ;; - noauthor (na), including bare (b), caps (c) and bare-caps (bc) variants,
+;; - nocite (n),
 ;; - year (y), including a bare (b) variant,
 ;; - text (t). including caps (c), full (f), and caps-full (cf) variants,
 ;; - default style, including bare (b), caps (c) and bare-caps (bc) variants.
+;;
+;; Using "*" as a key in a nocite citation includes all available items in
+;; the printed bibliography.
 
 ;; CSL styles recognize "locator" in citation references' suffix.  For example,
 ;; in the citation
@@ -103,6 +107,7 @@
 (declare-function citeproc-create "ext:citeproc")
 (declare-function citeproc-citation-create "ext:citeproc")
 (declare-function citeproc-append-citations "ext:citeproc")
+(declare-function citeproc-add-uncited "ext:citeproc")
 (declare-function citeproc-render-citations "ext:citeproc")
 (declare-function citeproc-render-bib "ext:citeproc")
 (declare-function citeproc-hash-itemgetter-from-any "ext:citeproc")
@@ -296,6 +301,12 @@ INFO is the export state, as a property list."
    (citeproc-proc-style
     (org-cite-csl--processor info))))
 
+(defun org-cite-csl--nocite-p (citation info)
+  "Non-nil when CITATION object's style is nocite.
+INFO is the export state, as a property list."
+  (member (car (org-cite-citation-style citation info))
+          '("nocite" "n")))
+
 (defun org-cite-csl--create-structure-params (citation info)
   "Return citeproc structure creation params for CITATION object.
 STYLE is the citation style, as a string or nil. INFO is the export state, as
@@ -535,20 +546,31 @@ INFO is the export state, as a property list.
 Return an alist (CITATION . OUTPUT) where CITATION object has been rendered as
 OUTPUT using Citeproc."
   (or (plist-get info :cite-citeproc-rendered-citations)
-      (let* ((citations (org-cite-list-citations info))
-             (processor (org-cite-csl--processor info))
-             (structures
-              (mapcar (lambda (c) (org-cite-csl--create-structure c info))
-                      citations)))
-        (citeproc-append-citations structures processor)
-        (let* ((rendered
-                (citeproc-render-citations
-                 processor
-                 (org-cite-csl--output-format info)
-                 (org-cite-csl--no-citelinks-p info)))
-               (result (seq-mapn #'cons citations rendered)))
-          (plist-put info :cite-citeproc-rendered-citations result)
-          result))))
+      (let ((citations (org-cite-list-citations info))
+	    (processor (org-cite-csl--processor info))
+	    normal-citations nocite-ids)
+	(dolist (citation citations)
+	  (if (org-cite-csl--nocite-p citation info)
+	      (setq nocite-ids (append (org-cite-get-references citation t) nocite-ids))
+	    (push citation normal-citations)))
+	(let ((structures
+	       (mapcar (lambda (c) (org-cite-csl--create-structure c info))
+		       (nreverse normal-citations))))
+	  (citeproc-append-citations structures processor))
+	(when nocite-ids
+	  (citeproc-add-uncited nocite-ids processor))
+	(let (result
+	      (rendered (citeproc-render-citations
+			 processor
+			 (org-cite-csl--output-format info)
+			 (org-cite-csl--no-citelinks-p info))))
+	  (dolist (citation citations)
+	    (push (cons citation
+			(if (org-cite-csl--nocite-p citation info) "" (pop rendered)))
+		  result))
+	  (setq result (nreverse result))
+	  (plist-put info :cite-citeproc-rendered-citations result)
+	  result))))
 
 \f
 ;;; Export capability
@@ -638,7 +660,8 @@ property list."
     (("noauthor" "na") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
     (("year" "y") ("bare" "b"))
     (("text" "t") ("caps" "c") ("full" "f") ("caps-full" "cf"))
-    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))))
+    (("nil") ("bare" "b") ("caps" "c") ("bare-caps" "bc"))
+    (("nocite" "n"))))
 
 (provide 'oc-csl)
 ;;; oc-csl.el ends here
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-02  8:32   ` András Simonyi
@ 2022-07-03 11:58     ` Ihor Radchenko
  2022-07-03 12:26       ` Bruce D'Arcus
  2022-07-04 11:54     ` [PATCH] oc-csl: Add support for nocite citations Ihor Radchenko
  1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-03 11:58 UTC (permalink / raw)
  To: András Simonyi; +Cc: emacs-orgmode list

András Simonyi <andras.simonyi@gmail.com> writes:

>> By "*", do you mean something like [cite/n:@*]?
>> If so, will it be correctly fontified as an existing citation?
>
> ... As for fontification, this is a very good
> question! I've checked it now with the built-in "basic"
> activation processor and it shows the "*" with an "error" face,
> indicating that it's not a key in the bibliography file(s), which
> might not be ideal. Nonetheless, this problem is not limited to or
> introduced by this patch, because the same construct and
> functionality is also supported by the "biblatex" and "natbib" export
> processors.  Actually, the possibility of using "*" as a key comes
> simply
> from a citeproc-el change, not from oc-csl, I just thought that it is
> obscure enough to merit an explicit mention in the NEWS file.

I do understand that @* syntax is coming from citeproc-el. However, we
are talking about changes to Org core. If Org highlights @* with 'error
face, some users will be confused.

Could you please elaborate about "the same construct and functionality
is also supported by the "biblatex" and "natbib" export processors"?
I cannot call myself expert in LaTeX, but I've never heard about LaTeX
\cite/\nocite commands supporting "*" argument. I cannot find any traces
of "*" functionality in oc-bibtelatex/oc-natbib as well.

Best,
Ihor



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-03 11:58     ` Ihor Radchenko
@ 2022-07-03 12:26       ` Bruce D'Arcus
  2022-07-03 12:35         ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-03 12:26 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]

Ihor - on *, he is bringing oc-csl in line with the oc-natbib and
oc-biblatex processors.

On Sun, Jul 3, 2022, 7:57 AM Ihor Radchenko <yantar92@gmail.com> wrote:

> András Simonyi <andras.simonyi@gmail.com> writes:
>
> >> By "*", do you mean something like [cite/n:@*]?
> >> If so, will it be correctly fontified as an existing citation?
> >
> > ... As for fontification, this is a very good
> > question! I've checked it now with the built-in "basic"
> > activation processor and it shows the "*" with an "error" face,
> > indicating that it's not a key in the bibliography file(s), which
> > might not be ideal. Nonetheless, this problem is not limited to or
> > introduced by this patch, because the same construct and
> > functionality is also supported by the "biblatex" and "natbib" export
> > processors.  Actually, the possibility of using "*" as a key comes
> > simply
> > from a citeproc-el change, not from oc-csl, I just thought that it is
> > obscure enough to merit an explicit mention in the NEWS file.
>
> I do understand that @* syntax is coming from citeproc-el. However, we
> are talking about changes to Org core. If Org highlights @* with 'error
> face, some users will be confused.
>
> Could you please elaborate about "the same construct and functionality
> is also supported by the "biblatex" and "natbib" export processors"?
> I cannot call myself expert in LaTeX, but I've never heard about LaTeX
> \cite/\nocite commands supporting "*" argument. I cannot find any traces
> of "*" functionality in oc-bibtelatex/oc-natbib as well.
>
> Best,
> Ihor
>
>
>

[-- Attachment #2: Type: text/html, Size: 2209 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-03 12:26       ` Bruce D'Arcus
@ 2022-07-03 12:35         ` Ihor Radchenko
  2022-07-03 12:38           ` Bruce D'Arcus
  2022-07-03 12:53           ` John Kitchin
  0 siblings, 2 replies; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-03 12:35 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: András Simonyi, emacs-orgmode list

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> Ihor - on *, he is bringing oc-csl in line with the oc-natbib and
> oc-biblatex processors.

I am sorry, but I still do not understand. AFAIK, \nocite{*} is not a
valid LaTeX command.

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-03 12:35         ` Ihor Radchenko
@ 2022-07-03 12:38           ` Bruce D'Arcus
  2022-07-03 12:53           ` John Kitchin
  1 sibling, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-03 12:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

I don't know the internals, I just know it works from org, though I'm not
near a computer ATM.

On Sun, Jul 3, 2022, 8:34 AM Ihor Radchenko <yantar92@gmail.com> wrote:

> "Bruce D'Arcus" <bdarcus@gmail.com> writes:
>
> > Ihor - on *, he is bringing oc-csl in line with the oc-natbib and
> > oc-biblatex processors.
>
> I am sorry, but I still do not understand. AFAIK, \nocite{*} is not a
> valid LaTeX command.
>
> Best,
> Ihor
>

[-- Attachment #2: Type: text/html, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-03 12:35         ` Ihor Radchenko
  2022-07-03 12:38           ` Bruce D'Arcus
@ 2022-07-03 12:53           ` John Kitchin
  2022-07-03 13:10             ` [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations) Ihor Radchenko
  1 sibling, 1 reply; 18+ messages in thread
From: John Kitchin @ 2022-07-03 12:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, Bruce D'Arcus, emacs-orgmode list

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

It is a special command. See

https://texfaq.org/FAQ-nocitestar

It is used to put all entries in a bibtex file in the bibliography.

Here is a minimal example Tex file that should list all the entries in
mybibliography.bib

\documentstyle{article}
\begin{document}
\nocite{*}
\bibliographystyle{unsrt}
\bibliography{mybibliography}
\end{document}


On Sun, Jul 3, 2022 at 8:35 AM Ihor Radchenko <yantar92@gmail.com> wrote:

> "Bruce D'Arcus" <bdarcus@gmail.com> writes:
>
> > Ihor - on *, he is bringing oc-csl in line with the oc-natbib and
> > oc-biblatex processors.
>
> I am sorry, but I still do not understand. AFAIK, \nocite{*} is not a
> valid LaTeX command.
>
> Best,
> Ihor
>
> --
John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
https://kitchingroup.cheme.cmu.edu
https://pointbreezepubs.gumroad.com/ pycse bookstore

[-- Attachment #2: Type: text/html, Size: 2073 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations)
  2022-07-03 12:53           ` John Kitchin
@ 2022-07-03 13:10             ` Ihor Radchenko
  2022-07-04  6:53               ` András Simonyi
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-03 13:10 UTC (permalink / raw)
  To: John Kitchin; +Cc: András Simonyi, Bruce D'Arcus, emacs-orgmode list

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> It is a special command. See
>
> https://texfaq.org/FAQ-nocitestar
>
> It is used to put all entries in a bibtex file in the bibliography.
>
> Here is a minimal example Tex file that should list all the entries in
> mybibliography.bib
>
> \documentstyle{article}
> \begin{document}
> \nocite{*}
> \bibliographystyle{unsrt}
> \bibliography{mybibliography}
> \end{document}

Thanks for the clarification!
Then, oc-natbib, oc-biblatex, and oc-csl should be modified to provide
an alternative activation function that will not highlight @* as
non-existing key.

Probably, we can even use an alternative "special" key face, not
'org-cite-key.

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations)
  2022-07-03 13:10             ` [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations) Ihor Radchenko
@ 2022-07-04  6:53               ` András Simonyi
  2022-07-04 12:28                 ` Ihor Radchenko
  0 siblings, 1 reply; 18+ messages in thread
From: András Simonyi @ 2022-07-04  6:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, Bruce D'Arcus, emacs-orgmode list

Dear All,

On Sun, 3 Jul 2022 at 15:09, Ihor Radchenko <yantar92@gmail.com> wrote:

> Then, oc-natbib, oc-biblatex, and oc-csl should be modified to provide
> an alternative activation function that will not highlight @* as
> non-existing key.
>
> Probably, we can even use an alternative "special" key face, not
> 'org-cite-key.

AFAICS, the situation is rather complex: Org (the main branch)
currently contains five export processors (basic, bibtex, natbib,
biblatex and csl), but only a single activation processor called
"basic". Of the five export processors the three LaTeX-based ones
already support the "*" key in nocite citations, and the CSL processor
could also with my proposed patch, leaving only the "basic" one
without this feature.

I think that the problem with simply adding one or more new activation
processors with different fontification for the "*" key is that Org
has no way of knowing (at least for sure) which export processor will
be used for a exporting a certain Org buffer, since it can depend on
the chosen export backend (see the variable
org-cite-export-processors). E.g., org-cite could be set up to use the
"natbib" processor for "LaTeX" export and the "basic" processor for
any other format.  I think that it'd be more in the spirit of the
"basic" activation processor to be more permissive and not treat "*"
as an error, similarly to citation styles not supported by the "basic"
export processor but supported by others.

best wishes,
András


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-02  8:32   ` András Simonyi
  2022-07-03 11:58     ` Ihor Radchenko
@ 2022-07-04 11:54     ` Ihor Radchenko
  2022-07-05 19:17       ` Bruce D'Arcus
  1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-04 11:54 UTC (permalink / raw)
  To: András Simonyi; +Cc: emacs-orgmode list

András Simonyi <andras.simonyi@gmail.com> writes:

> Thanks, I have tried to address your comments in the attached new
> version of the patch.
> Note that the quotes around "csl" follow the manual's "Citation
> handling" chapter.

Since the fontification part appears to be unrelated to this particular
patch, I'd like to ask people who use CSL to test the patch. I do not
use CSL myself.

I have no further comments on the lisp part.

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations)
  2022-07-04  6:53               ` András Simonyi
@ 2022-07-04 12:28                 ` Ihor Radchenko
  2022-07-04 12:57                   ` András Simonyi
  0 siblings, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-04 12:28 UTC (permalink / raw)
  To: András Simonyi; +Cc: John Kitchin, Bruce D'Arcus, emacs-orgmode list

András Simonyi <andras.simonyi@gmail.com> writes:

> I think that the problem with simply adding one or more new activation
> processors with different fontification for the "*" key is that Org
> has no way of knowing (at least for sure) which export processor will
> be used for a exporting a certain Org buffer, since it can depend on
> the chosen export backend (see the variable
> org-cite-export-processors). E.g., org-cite could be set up to use the
> "natbib" processor for "LaTeX" export and the "basic" processor for
> any other format.  I think that it'd be more in the spirit of the
> "basic" activation processor to be more permissive and not treat "*"
> as an error, similarly to citation styles not supported by the "basic"
> export processor but supported by others.

I do not agree.
If someone sets up natbib for latex export and basic for other formats,
"*" will not be correctly exported in those other formats (because basic
does not support @* syntax) - something fontification should better
highlight for the user.

Also, are there any similar non-key constructs in latex in addition to "*"?

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations)
  2022-07-04 12:28                 ` Ihor Radchenko
@ 2022-07-04 12:57                   ` András Simonyi
  2022-07-04 13:16                     ` Bruce D'Arcus
  0 siblings, 1 reply; 18+ messages in thread
From: András Simonyi @ 2022-07-04 12:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: John Kitchin, Bruce D'Arcus, emacs-orgmode list

Dear All,

On Mon, 4 Jul 2022 at 14:27, Ihor Radchenko <yantar92@gmail.com> wrote:

> András Simonyi <andras.simonyi@gmail.com> writes:

> I do not agree.
> If someone sets up natbib for latex export and basic for other formats,
> "*" will not be correctly exported in those other formats (because basic
> does not support @* syntax) - something fontification should better
> highlight for the user.

yes, the basic export processor is, well, basic in certain respects.
But then this is the case with more advanced citation styles, e.g.
"locators" as well, which is supported by the biblatex export
processor and not by "basic"; nonetheless, the "basic" activation
processor's fontification doesn't signal "error" if someone uses the
"locators"  style, in fact it doesn't check whether a used citation
style is supported by any of the processors. It seems to me that "*"
as a key is sophisticated enough that if we have to make a decision
about the default fontification then it is better to err on the side
of supposing that a user using it knows what they are doing, Of
course, others' mileage may vary, and it'd be very interesting to hear
other opinions.

best wishes,
András



> Also, are there any similar non-key constructs in latex in addition to "*"?
>
> Best,
> Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations)
  2022-07-04 12:57                   ` András Simonyi
@ 2022-07-04 13:16                     ` Bruce D'Arcus
  0 siblings, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-04 13:16 UTC (permalink / raw)
  To: András Simonyi; +Cc: Ihor Radchenko, John Kitchin, emacs-orgmode list

On Mon, Jul 4, 2022 at 8:57 AM András Simonyi <andras.simonyi@gmail.com> wrote:
> It seems to me that "*" as a key is sophisticated enough that if we have to make a decision
> about the default fontification then it is better to err on the side
> of supposing that a user using it knows what they are doing,

+1

Bruce


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-04 11:54     ` [PATCH] oc-csl: Add support for nocite citations Ihor Radchenko
@ 2022-07-05 19:17       ` Bruce D'Arcus
  2022-07-05 19:28         ` Bruce D'Arcus
  2022-07-07 10:46         ` Ihor Radchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-05 19:17 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, emacs-orgmode list

On Mon, Jul 4, 2022 at 7:54 AM Ihor Radchenko <yantar92@gmail.com> wrote:

> Since the fontification part appears to be unrelated to this particular
> patch, I'd like to ask people who use CSL to test the patch.

I just tested it, and it works as expected.

Except, and I'm not sure if I'm misunderstanding some org detail, but
this doesn't suppress the global bibliography. Should it?

#+bibliography: test.bib
#+cite_export: csl
[cite/nocite:@*]
#+print_bibliography:

# Local Variables:
# org-cite-global-bibliography: nil
# End:

Bruce


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-05 19:17       ` Bruce D'Arcus
@ 2022-07-05 19:28         ` Bruce D'Arcus
  2022-07-05 19:37           ` Bruce D'Arcus
  2022-07-07 10:46         ` Ihor Radchenko
  1 sibling, 1 reply; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-05 19:28 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, emacs-orgmode list

On Tue, Jul 5, 2022 at 3:17 PM Bruce D'Arcus <bdarcus@gmail.com> wrote:
>
> On Mon, Jul 4, 2022 at 7:54 AM Ihor Radchenko <yantar92@gmail.com> wrote:
>
> > Since the fontification part appears to be unrelated to this particular
> > patch, I'd like to ask people who use CSL to test the patch.
>
> I just tested it, and it works as expected.
>
> Except, and I'm not sure if I'm misunderstanding some org detail, but
> this doesn't suppress the global bibliography. Should it?

Yes, and it does in oc-biblatex.

Bruce


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-05 19:28         ` Bruce D'Arcus
@ 2022-07-05 19:37           ` Bruce D'Arcus
  0 siblings, 0 replies; 18+ messages in thread
From: Bruce D'Arcus @ 2022-07-05 19:37 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: András Simonyi, emacs-orgmode list

On Tue, Jul 5, 2022 at 3:28 PM Bruce D'Arcus <bdarcus@gmail.com> wrote:

> > Except, and I'm not sure if I'm misunderstanding some org detail, but
> > this doesn't suppress the global bibliography. Should it?
>
> Yes, and it does in oc-biblatex.

Sorry for the noise; disregard.

It was something with my testing setup.

Bruce


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] oc-csl: Add support for nocite citations
  2022-07-05 19:17       ` Bruce D'Arcus
  2022-07-05 19:28         ` Bruce D'Arcus
@ 2022-07-07 10:46         ` Ihor Radchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2022-07-07 10:46 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: András Simonyi, emacs-orgmode list

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> On Mon, Jul 4, 2022 at 7:54 AM Ihor Radchenko <yantar92@gmail.com> wrote:
>
>> Since the fontification part appears to be unrelated to this particular
>> patch, I'd like to ask people who use CSL to test the patch.
>
> I just tested it, and it works as expected.

Thanks!
Applied onto main via b3b17cdb6.

Best,
Ihor


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-07-07 10:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01  9:30 [PATCH] oc-csl: Add support for nocite citations András Simonyi
2022-07-02  4:38 ` Ihor Radchenko
2022-07-02  8:32   ` András Simonyi
2022-07-03 11:58     ` Ihor Radchenko
2022-07-03 12:26       ` Bruce D'Arcus
2022-07-03 12:35         ` Ihor Radchenko
2022-07-03 12:38           ` Bruce D'Arcus
2022-07-03 12:53           ` John Kitchin
2022-07-03 13:10             ` [BUG] @* in [cite/nocite:@*] is a valid special LaTeX bibliography key, but it is highlighted using "error" face by oc.el (was: [PATCH] oc-csl: Add support for nocite citations) Ihor Radchenko
2022-07-04  6:53               ` András Simonyi
2022-07-04 12:28                 ` Ihor Radchenko
2022-07-04 12:57                   ` András Simonyi
2022-07-04 13:16                     ` Bruce D'Arcus
2022-07-04 11:54     ` [PATCH] oc-csl: Add support for nocite citations Ihor Radchenko
2022-07-05 19:17       ` Bruce D'Arcus
2022-07-05 19:28         ` Bruce D'Arcus
2022-07-05 19:37           ` Bruce D'Arcus
2022-07-07 10:46         ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.