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

2023-01-23 Thread Edgar Lux
On Jan 23, 2023 at 12:06 PM, Ihor Radchenko  wrote:Edgar 
Lux  writes:
> So, what is the problem with LATEX_HEADER approach?

I thought that it would be preferable to have a native Org syntax.

> I do not like passing the options as-is in #+cite_export because not all
> the possible biblatex \usepackage options are affecting the
> bibliography. Options like sortcites, maxcitenames, autocite, etc are
> only affecting the citation style, not the bibliography. And options
> like bibencoding are totally irrelevant to both citation and
> bibliography styles.

That's fair, but it can just as well be used as a line to configure biblatex 
(since it is already being used anyway). Besides, there are many other options 
which do concern the style or are very needed 
(hyperref=true,backref=true,url=true,backend=biber,natbib=true). I'm not 
advocating for my suggestion, just showing my reasoning. As I said, I'm fine 
with the =#+latex_header:=.

> > 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
>
> This is actually confusing.
> This code is by Nicolas, but does not seem to be consistent with the
> idea of "BIBLIOGRAPHY STYLE".
>
> I am CCing him in cause if there is something I am missing.

The docstring says:

;; "cite_export" keyword.  If you need to use different styles for 
bibliography
;; and citations, you can separate them with "bibstyle/citestyle" syntax.  
E.g.,
;;
;;   #+cite_export: biblatex authortitle/authortitle-ibid

> This is plain abusing.
> We might remove the "/" matching completely and throw an error if there
> are commas inside style name. Users must not rely on such undocumented
> behavior.

Let the user decide (?). If she gets to that point, she surely knows how to 
(ab)use it--in her favour.

> 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:

[I do not see any patch attached]

WTF... again! (sorry)

diff --git a/lisp/oc-biblatex.el b/lisp/oc-biblatex.el
index a27f9e9bf..3e912f2d9 100644
--- a/lisp/oc-biblatex.el
+++ b/lisp/oc-biblatex.el
@@ -99,6 +99,10 @@ Return a string."
 (style-options
  (cond
   ((null style) nil)
+  ((string-match "style=" style)
+   (list (replace-regexp-in-string
+  "\\(style=[^/]*\\)/" "\\1,citestyle="
+  (org-unbracket-string "[" "]" style
   ((not (string-match "/" style)) (list (concat "style=" style)))
   (t
(list (concat "bibstyle=" (substring style nil (match-beginning 
0)))

> Why not storing email locally? Account limits are non-issue then ;)

The server does not allow me to download e-mails! (free as in... half a beer. I 
can get the full beer if I pay for it, though). Thanks for the suggestion.


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



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

2023-01-23 Thread Ihor Radchenko
Edgar Lux  writes:

>> > #+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

So, what is the problem with LATEX_HEADER approach?

I do not like passing the options as-is in #+cite_export because not all
the possible biblatex \usepackage options are affecting the
bibliography. Options like sortcites, maxcitenames, autocite, etc are
only affecting the citation style, not the bibliography. And options
like bibencoding are totally irrelevant to both citation and
bibliography styles.

>> 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

This is actually confusing.
This code is by Nicolas, but does not seem to be consistent with the
idea of "BIBLIOGRAPHY STYLE".

I am CCing him in cause if there is something I am missing.

> 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

This is an implementation detail. We cannot promise such things working
reliably.

> 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
> ...

This is plain abusing.
We might remove the "/" matching completely and throw an error if there
are commas inside style name. Users must not rely on such undocumented
behavior.

> 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:

[I do not see any patch attached]

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

Why not storing email locally? Account limits are non-issue then ;)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



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

2023-01-23 Thread Ihor Radchenko
Edgar Lux  writes:

> Just in case, I think that you meant #+bind: . However, it didn't work for me 
> (I'm blaming myself). I added this in line 16 of my 324-lines file
>
> #+bind: org-cite-biblatex-options "opt=true"
>
> but the =opt=true= value is not shown next to =\usepackage{biblatex}= when I 
> export. I do have =org-export-allow-bind-keywords= set to =t=

13.2 Export Settings
   If ‘org-export-allow-bind-keywords’ is non-‘nil’, Emacs variables can
become buffer-local during export by using the ‘BIND’ keyword.  Its
syntax is ‘#+BIND: variable value’.  This is particularly useful for
in-buffer settings that cannot be changed using keywords.


#+BIND is ignored by default for safety reasons.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



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

2023-01-22 Thread Edgar Lux
January 22, 2023 at 12:15:14 PM CET Ihor Radchenko  
wrote:Edgar Lux  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

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

2023-01-22 Thread Edgar Lux
January 22, 2023 at 12:36:32 PM CET "András Simonyi"  
wrote:Dear All,

> There is also the customizable variable `org-cite-biblatex-options' to
> pass additional options,

That is very useful, indeed (I didn't know how to use it). Hopefully the e-mail 
which I just sent helps with the documentation.

> which could be used with #bind+ if document-specific options are needed.

Just in case, I think that you meant #+bind: . However, it didn't work for me 
(I'm blaming myself). I added this in line 16 of my 324-lines file

#+bind: org-cite-biblatex-options "opt=true"

but the =opt=true= value is not shown next to =\usepackage{biblatex}= when I 
export. I do have =org-export-allow-bind-keywords= set to =t=

> best wishes,
> András

you too!


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



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

2023-01-22 Thread András Simonyi
Dear All,

On Sun, 22 Jan 2023 at 12:15, Ihor Radchenko  wrote:

> Also, note that `org-cite-biblatex--package-options' combines INITIAL
> option list from the \usepackage declaration already present with
> options dictated by STYLE. However, only certain options are considered.
> After applying your patch, things may be broken in this area.

There is also the customizable variable `org-cite-biblatex-options' to
pass additional options,
which could be used with #bind+ if document-specific options are needed.

best wishes,
András

> P.S. Could you please send patches as plain text? They are easier to
> view then.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>



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

2023-01-22 Thread Ihor Radchenko
Edgar Lux  writes:

> I would suggest that the org-info pages mention (require 'oc-biblatex) and 
> show an example of  how one can use extra options (with the #+latex_header as 
> well). Further, may be it would be better to allow something like this:

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.

> #+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

There, NAME is the name of a registered citation processor providing export
functionality, as a symbol.  BIBLIOGRAPHY-STYLE (respectively CITATION-STYLE)
is the desired default style to use when printing a bibliography (respectively
exporting a citation), as a string or nil.  Both BIBLIOGRAPHY-STYLE and
CITATION-STYLE are optional.  NAME is mandatory.

I am not sure how your idea fits the above.

Also, note that `org-cite-biblatex--package-options' combines INITIAL
option list from the \usepackage declaration already present with
options dictated by STYLE. However, only certain options are considered.
After applying your patch, things may be broken in this area.

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

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



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

2023-01-21 Thread Edgar Lux
For the very silly reason that I was not aware of it >.< . Thank you, Ihor. 

For the uninformed: evaluate this as a lisp expression (require 'oc-biblatex) . 
Also, you can use either  #+LaTeX_HEADER: \usepackage... (like shown in this 
thread) or style options with #+cite_export: biblatex (read the documentation 
for oc-biblatex.el). I tested like this (and with the \usepackage line too):

#+cite_export: biblatex
#+bibliography: your_file.bib

This:

#+cite_export: biblatex "bibstyle=numeric-comp,sorting=none, 
hyperref=true,backref=true,url=true,backend=biber,natbib=true"

will create

\usepackage[style=bibstyle=numeric-comp,sorting=none, 
hyperref=true,backref=true,url=true,backend=biber,natbib=true]{biblatex}

(note the style=bibstyle=)

I would suggest that the org-info pages mention (require 'oc-biblatex) and show 
an example of  how one can use extra options (with the #+latex_header as well). 
Further, may be it would be better to allow something like this:

#+cite_export: biblatex "bibstyle=numeric-comp,sorting=none, 
hyperref=true,backref=true,url=true,backend=biber,natbib=true"
#+bibliography: your_file.bib

For which one can use the appended patch, which may break other things, of 
course :P . The gain is control over biblatex options without resorting to 
#+latex_header: \usepackage[...]{biblatex}

Cheers! Thanks.

January 21, 2023 at 9:37:18 AM CET Ihor Radchenko  
wrote:Edgar Lux  writes:

I now looked at the patch and I have one general question. What you
don't just use oc-biblatex in the above?


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


oc-biblatex.patch.gz
Description: File Attachment: oc-biblatex.patch.gz


oc-biblatex-postpatch-tests.txt.gz
Description: File Attachment: oc-biblatex-postpatch-tests.txt.gz


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

2023-01-21 Thread Ihor Radchenko
Edgar Lux  writes:

> I send the attached patch for your consideration. It allows to use biber for 
> bibliographies. I tested it with this:
>
> (require 'oc-natbib)
>
> #+cite_export: natbib
> #+LaTeX_HEADER: \usepackage[style=numeric-comp,sorting=none, 
> hyperref=true,backref=true,url=true,backend=biber,natbib=true]{biblatex}
> #+LaTeX_HEADER: \addbibresource{../../Sources/sources.bib}

I now looked at the patch and I have one general question. What you
don't just use oc-biblatex in the above?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



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

2023-01-20 Thread Edgar Lux
LOL What an idio...! (sorry)

January 20, 2023 at 11:59:22 AM CET Ihor Radchenko  
wrote:Edgar Lux  writes:

> I send the attached patch for your consideration. It allows to use biber for
bibliographies. I tested it with this:

Thanks, but could you please attach the patch?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

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


oc-natbib.el.patch.gz
Description: File Attachment: oc-natbib.el.patch.gz


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

2023-01-20 Thread Ihor Radchenko
Edgar Lux  writes:

> I send the attached patch for your consideration. It allows to use biber for 
> bibliographies. I tested it with this:

Thanks, but could you please attach the patch?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at