emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for \usepackage[ ... natbib = true ...]{...biblatex} with org-


From: Edgar Lux
Subject: Re: Patch for \usepackage[ ... natbib = true ...]{...biblatex} with org-cite
Date: Sun, 22 Jan 2023 20:19:21 +0100 (CET)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]