emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edgar Lux <edgarlux@mailfence.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Patch for \usepackage[ ... natbib = true ...]{...biblatex} with org-cite
Date: Sun, 22 Jan 2023 20:19:21 +0100 (CET)	[thread overview]
Message-ID: <865655434.1045612.1674415160995@fidget.co-bxl> (raw)
In-Reply-To: <873582om65.fsf@localhost>

January 22, 2023 at 12:15:14 PM CET Ihor Radchenko <yantar92@posteo.net> wrote:Edgar Lux <edgarlux@mailfence.com> writes:
> Note that we have https://orgmode.org/manual/Citation-export-processors.html
> Of course, the "Citations" section of the manual is not yet complete.
> More examples and details will be welcome.

Yes, indeed

> >     #+cite_export: biblatex "bibstyle=numeric-comp,sorting=none, hyperref=true,backref=true,url=true,backend=biber,natbib=true"
>
> The general design is
> #+cite_export: NAME BIBLIOGRAPHY-STYLE CITATION-STYLE
> ... removed content ...
> I am not sure how your idea fits the above.

The general design only allows two options (and their values) to be passed to =biblatex= (in the =#+cite_export:= line): =bibstyle= and =citestyle=. However, =biblatex= can take many more options. Currently (correct me if I am wrong), the two alternatives to pass more options is to use a =org-cite-biblatex-options= or a line like this

#+begin_src org
  ,#+LaTeX_HEADER: \usepackage[bibstyle=numeric-comp,sorting=none, hyperref=true,backref=true,url=true,backend=biber,natbib=true]{biblatex}
#+end_src

> Also, note that `org-cite-biblatex--package-options' combines INITIAL
> option list from the \usepackage declaration already present with
> options dictated by STYLE.

Precisely.

> However, only certain options are considered.
> After applying your patch, things may be broken in this area.

One of the attachments showed what I considered to be all possible cases: the new string (containing =style==; it could be either =bibstyle==, =citestyle==. It is similar to the case which allows for ="bibstyle/citestyle"=, as documented on line 34 of =oc-biblatex.el=). Currently (these could, hopefully, also be used for the documentation), if somebody uses

1. case
   #+begin_src org
     #+cite_export: biblatex "how/much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=how,citestyle=much]{biblatex}
   #+end_src

2. case
   #+begin_src org
     #+cite_export: biblatex "how" "much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[style=how]{biblatex}
   #+end_src

3. case
   #+begin_src org
     #+cite_export: biblatex "how,opt=true"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[style=how,opt=true]{biblatex}
   #+end_src

4. case
   #+begin_src org
     #+cite_export: biblatex "how/much,hack=true"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=how,citestyle=much,hack=true]{biblatex}
   #+end_src

5. case
   #+begin_src org
     #+cite_export: biblatex "citestyle=corner/much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=citestyle=corner,citestyle=much]{biblatex}
   #+end_src

6. case
   #+begin_src org
     #+cite_export: biblatex "citestyle=corner/much,opt=true"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=citestyle=corner,citestyle=much,opt=true]{biblatex}
   #+end_src

7. case
   #+begin_src org
     #+cite_export: biblatex "bibstyle=corner"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[style=bibstyle=corner]{biblatex}
   #+end_src

8. case
   #+begin_src org
     #+cite_export: biblatex "bibstyle=corner/much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=bibstyle=corner,citestyle=much]{biblatex}
   #+end_src

9. case
   #+begin_src org
     #+cite_export: biblatex "[bibstyle=corner/much]"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=[bibstyle=corner,citestyle=much]]{biblatex}
   #+end_src

10. case (note that this can be combined with all the above)
    #+begin_src emacs-lisp
      (setq org-cite-biblatex-options "nulloption=true")
    #+end_src

    #+begin_src org
      #+cite_export: biblatex "how/much"
    #+end_src

    the result is
    #+begin_src latex
      \usepackage[nulloption=true,bibstyle=how,citestyle=much]{biblatex}
    #+end_src

whether some of these are broken is up for discussion. The suggested patch adds one conditional case, which searches for ="syle="=, takes away the brackets and turns the above cases into:

1. case
   #+begin_src org
     #+cite_export: biblatex "how/much"
   #+end_src

   same result as above

2. case
   #+begin_src org
     #+cite_export: biblatex "how" "much"
   #+end_src

   same result as above

3. case
   #+begin_src org
     #+cite_export: biblatex "how,opt=true"
   #+end_src

   same result as above

4. case
   #+begin_src org
     #+cite_export: biblatex "how/much,hack=true"
   #+end_src

   same result as above

5. case
   #+begin_src org
     #+cite_export: biblatex "citestyle=corner/much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[citestyle=corner,citestyle=much]{biblatex}
   #+end_src

6. case
   #+begin_src org
     #+cite_export: biblatex "citestyle=corner/much,opt=true"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[citestyle=corner,citestyle=much,opt=true]{biblatex}
   #+end_src

7. case
   #+begin_src org
     #+cite_export: biblatex "bibstyle=corner"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=corner]{biblatex}
   #+end_src

8. case
   #+begin_src org
     #+cite_export: biblatex "bibstyle=corner/much"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=corner,citestyle=much]{biblatex}
   #+end_src

9. case
   #+begin_src org
     #+cite_export: biblatex "[bibstyle=corner/much]"
   #+end_src

   the result is
   #+begin_src latex
     \usepackage[bibstyle=corner,citestyle=much]{biblatex}
   #+end_src

10. case (note that this can be combined with all the above)
    #+begin_src emacs-lisp
      (setq org-cite-biblatex-options "nulloption=true")
    #+end_src

    #+begin_src org
      #+cite_export: biblatex "how/much"
    #+end_src

    same result as above

In this way, =org-cite-biblatex-options= is completely optional (an addendum to =#+cite_export: biblatex=), and more options (other than =bibstyle= and =citestyle=) can be added next to =#+cite_export: biblatex= (without hacks in between lines, as shown above).

Anyway! the "for your consideration" already implies something, and I can live with an extra =#+latex_header:=.

>
> P.S. Could you please send patches as plain text? They are easier to
> view then.

Sure. I hope that the code above suffices :) . I compress, because I don't have unlimited space in my account.

-- 
Sent with https://mailfence.com  
Secure and private email


  parent reply	other threads:[~2023-01-22 19:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 21:31 Patch for \usepackage[ ... natbib = true ...]{...biblatex} with org-cite Edgar Lux
2023-01-20 10:59 ` Ihor Radchenko
2023-01-20 16:57   ` Edgar Lux
2023-01-21  8:37 ` Ihor Radchenko
2023-01-21 20:25   ` Edgar Lux
2023-01-22 11:15     ` Ihor Radchenko
2023-01-22 11:36       ` András Simonyi
2023-01-22 19:47         ` Edgar Lux
2023-01-23 10:43           ` Ihor Radchenko
2023-01-22 19:19       ` Edgar Lux [this message]
2023-01-23 11:06         ` Ihor Radchenko
2023-01-23 20:58           ` Edgar Lux
2023-01-24 10:54             ` [BUG] #+cite_export: ... bibstyle citestyle cannot be universally used as global defaults (was: Patch for \usepackage[ ... natbib = true ...]{...biblatex} with org-cite) Ihor Radchenko
2023-02-03  9:33               ` Edgar Lux
2023-02-04 11:31                 ` Ihor Radchenko
2023-02-04 23:14                   ` Edgar Lux

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=865655434.1045612.1674415160995@fidget.co-bxl \
    --to=edgarlux@mailfence.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).