From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: PATCH allow explicit style= in #+cite_export: biblatex
Date: Wed, 17 Apr 2024 09:00:26 +0200 [thread overview]
Message-ID: <CAO48Bk8e=eXQwYpJ+OCzfQqhauyS_jWc8BgvgCjaJJ4Q=tHUVA@mail.gmail.com> (raw)
In-Reply-To: <CAO48Bk84KpbAwh9NpZANshEeJVri4+=uB89SVwiGYSWLCETmSg@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 4290 bytes --]
Stop the press... I discovered a small bug in the last patch.
Attached is a new version.
/PA
On Wed, 17 Apr 2024 at 08:22, Pedro Andres Aranda Gutierrez <
paaguti@gmail.com> wrote:
> Hi again
>
> Rationale of the patch:
> Currently, when the options to biblatex are _not_ xxx/xxx format, a style=
> is prepended, because
> it is assumed that it will be a biblatex options string starting with a
> style.
> With the proposed patch, I add the possibility of using a biblatex options
> string where style= is stated
> explicitly (anywhere in the string). This adds congruency WRT
> the ~org-cite-biblatex-options~ variable.
>
> Best, /PA
>
> On Sun, 14 Apr 2024 at 09:16, Pedro Andres Aranda Gutierrez <
> paaguti@gmail.com> wrote:
>
>> HI, full answer...
>>
>> In the original code, that section prepends "style=" in some cases. I
>> have stumbled across
>> instances where the options started with style= because they were taken
>> directly from LaTeX
>> and the generated code ended by like:
>> \usepackage[style=style=numeric,backend=biber]{biblatex}
>> for
>> #+cite_export: biblatex style=numeric,backend=biber
>> which, BTW, is something someone used the LaTeX may parse as correct.
>> I was just trying to cater for this case.
>>
>> Best, /PA
>>
>>
>> On Sun, 14 Apr 2024 at 07:30, Pedro Andres Aranda Gutierrez <
>> paaguti@gmail.com> wrote:
>>
>>> Sorry... I was not right... You are right. I'll take a look at it again.
>>> /PA
>>>
>>> On Sun, 14 Apr 2024 at 07:22, Pedro Andres Aranda Gutierrez <
>>> paaguti@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Maybe not... because style= is a keyword for the biblatex package,
>>>> while bibstyle or citestyle aren't.
>>>>
>>>> Best, /PA
>>>>
>>>> On Sat, 13 Apr 2024 at 16:32, Ihor Radchenko <yantar92@posteo.net>
>>>> wrote:
>>>>
>>>>> Pedro Andres Aranda Gutierrez <paaguti@gmail.com> writes:
>>>>>
>>>>> > HI,
>>>>> > Attached is a small patch to allow explicitly adding style= in the
>>>>> biblatex export options, to increase consistency with
>>>>> > Customisation variables.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> > (style-options
>>>>> > (cond
>>>>> > ((null style) nil)
>>>>> > + ;; allow the user to include "style=" anywhere in the
>>>>> style options
>>>>> > + ((string-match "\\(^s\\|,s\\)tyle=" style) (list style))
>>>>> > ((not (string-match "/" style)) (list (concat "style="
>>>>> style)))
>>>>> > (t
>>>>> > (list (concat "bibstyle=" (substring style nil
>>>>> (match-beginning 0)))
>>>>>
>>>>> If we allow style=..., may as well allow bibstyle= and citestyle=.
>>>>>
>>>>> --
>>>>> Ihor Radchenko // yantar92,
>>>>> Org mode contributor,
>>>>> Learn more about Org mode at <https://orgmode.org/>.
>>>>> Support Org development at <https://liberapay.com/org-mode>,
>>>>> or support my work at <https://liberapay.com/yantar92>
>>>>>
>>>>
>>>>
>>>> --
>>>> Fragen sind nicht da, um beantwortet zu werden,
>>>> Fragen sind da um gestellt zu werden
>>>> Georg Kreisler
>>>>
>>>> Headaches with a Juju log:
>>>> unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
>>>> run a leader-deposed hook here, but we can't yet
>>>>
>>>>
>>>
>>> --
>>> Fragen sind nicht da, um beantwortet zu werden,
>>> Fragen sind da um gestellt zu werden
>>> Georg Kreisler
>>>
>>> Headaches with a Juju log:
>>> unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
>>> run a leader-deposed hook here, but we can't yet
>>>
>>>
>>
>> --
>> Fragen sind nicht da, um beantwortet zu werden,
>> Fragen sind da um gestellt zu werden
>> Georg Kreisler
>>
>> Headaches with a Juju log:
>> unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should
>> run a leader-deposed hook here, but we can't yet
>>
>>
>
> --
> Fragen sind nicht da, um beantwortet zu werden,
> Fragen sind da um gestellt zu werden
> Georg Kreisler
>
> Headaches with a Juju log:
> unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
> a leader-deposed hook here, but we can't yet
>
>
--
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler
Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
[-- Attachment #1.2: Type: text/html, Size: 7409 bytes --]
[-- Attachment #2: 0001-Allow-explicit-style-in-cite_export-options.patch --]
[-- Type: text/x-patch, Size: 3396 bytes --]
From 82f1cecaf5c011506c6cc57cb3835b6f8eba0f6d Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paaguti@gmail.com>
Date: Wed, 17 Apr 2024 08:19:22 +0200
Subject: [PATCH 1/2] Allow explicit style= in cite_export options
lisp/oc-biblatex.el: Allow explicit style= in biblatex cite-export
doc/org-manual.org: Clarify documentation regarding biblatex cite-export
---
doc/org-manual.org | 10 +++++++++-
lisp/oc-biblatex.el | 31 +++++++++++++++++--------------
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 6c699ae1e..2de5df3af 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17614,7 +17614,15 @@ style and the =bibtex= backend. Always define the style first and then
the rest of load-time options for the =biblatex=
package. Alternatively, use the ~org-cite-biblatex-options~ variable
in your Emacs configuration. It will only export to PDF, since it
-relies on the ~biblatex~ processor of your LaTeX installation;
+relies on the ~biblatex~ processor of your LaTeX installation.
+
+The previous example assumes the first element in the options is a
+style. Alternatively you can specify ~style=~ explicitly anywhere in
+the options string (as you would when setting the
+~org-cite-biblatex-options~ variable in your Emacs configuration):
+
+: #+cite_export: biblatex backend=bibtex,style=numeric
+
** Bibliography printing
diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el
index 36c0ee7e5..13e160ac1 100644
--- a/lisp/oc-biblatex.el
+++ b/lisp/oc-biblatex.el
@@ -190,20 +190,23 @@ INITIAL is an initial style of comma-separated options, as a string or nil.
STYLE is the style definition as a string or nil.
Return a string."
- (let ((options-no-style
- (and initial
- (let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
- (seq-filter
- (lambda (option) (not (string-match re option)))
- (split-string (org-unbracket-string "[" "]" initial)
- "," t " \t")))))
- (style-options
- (cond
- ((null style) nil)
- ((not (string-match "/" style)) (list (concat "style=" style)))
- (t
- (list (concat "bibstyle=" (substring style nil (match-beginning 0)))
- (concat "citestyle=" (substring style (match-end 0))))))))
+ (let* ((options-no-style
+ (and initial
+ (let ((re (rx string-start (or "bibstyle" "citestyle" "style"))))
+ (seq-filter
+ (lambda (option) (not (string-match re option)))
+ (split-string (org-unbracket-string "[" "]" initial)
+ "," t " \t")))))
+ ;; Did we state the style as style= in the options?
+ (explicit-style (string-match-p "\\(\\`s\\|,s\\)tyle=" style))
+ (style-options
+ (cond
+ ((null style) nil)
+ ;; prepend style= if not already in options
+ ((not (string-match "/" style)) (list (if explicit-style style (concat "style=" style))))
+ (t
+ (list (concat "bibstyle=" (substring style nil (match-beginning 0)))
+ (concat "citestyle=" (substring style (match-end 0))))))))
(if (or options-no-style style-options)
(format "[%s]"
(mapconcat #'identity
--
2.34.1
next prev parent reply other threads:[~2024-04-17 7:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-13 7:14 PATCH allow explicit style= in #+cite_export: biblatex Pedro Andres Aranda Gutierrez
2024-04-13 14:33 ` Ihor Radchenko
2024-04-14 5:22 ` Pedro Andres Aranda Gutierrez
2024-04-14 5:30 ` Pedro Andres Aranda Gutierrez
2024-04-14 7:16 ` Pedro Andres Aranda Gutierrez
2024-04-17 6:22 ` Pedro Andres Aranda Gutierrez
2024-04-17 7:00 ` Pedro Andres Aranda Gutierrez [this message]
2024-04-17 15:45 ` Pedro Andres Aranda Gutierrez
2024-04-21 13:21 ` Ihor Radchenko
2024-04-21 15:38 ` Pedro Andres Aranda Gutierrez
2024-04-22 19:46 ` Ihor Radchenko
[not found] ` <CAO48Bk_2xjGrN9Qgfe7hpnDnw=do5geKe3XnEA8wJr_dn8SZYg@mail.gmail.com>
[not found] ` <87ttjspaor.fsf@localhost>
[not found] ` <CAO48Bk91MjUAi-AUbhKfKEZGQcJbb1yZWCNoM8U+cObUCH0bVw@mail.gmail.com>
2024-04-24 17:06 ` Ihor Radchenko
2024-04-25 5:34 ` Pedro Andres Aranda Gutierrez
2024-04-26 12:24 ` Ihor Radchenko
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAO48Bk8e=eXQwYpJ+OCzfQqhauyS_jWc8BgvgCjaJJ4Q=tHUVA@mail.gmail.com' \
--to=paaguti@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).