Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2024-02-13 Thread Ihor Radchenko


Alessandro Bertulli  writes:
> I think I spotted the problem. It's difficult to be sure, but
> apparently, since version 4.31, latexmk automatically detects and run
> biber as a citation engine (see this post
> https://tex.stackexchange.com/a/231351/259874). In fact, in the latexmk
> man page, it is said to use the option -bibtex to use BibTeX.

On the latest Org, using latexmk 4.80, I can compile using both biblatex
and natbib citation processors just fine.

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



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Hi,

I think I spotted the problem. It's difficult to be sure, but
apparently, since version 4.31, latexmk automatically detects and run
biber as a citation engine (see this post
https://tex.stackexchange.com/a/231351/259874). In fact, in the latexmk
man page, it is said to use the option -bibtex to use BibTeX.

Indeed, if I try to run "latexmk -pdf -bibtex -f" (the -f option is
needed due to some errors given by whitespaces in the citations), it all
works fine. From my point of view, the problem here is that the variable
org-LaTeX-pdf-process doesn't track any of this!
+ If the variable cite_export is set to basic or to csl, the formatting
is external to LaTeX, so no problem.
+ If it is set to biblatex, then biber is automatically called by
latexmk
+ If it is set to natbib, LaTeX needs BibTeX to be called, but it is
not!

So I'd say this is a bug of the org-LaTeX-pdf-process variable. Should
it be buffer-local, and set when exporting? This is not something I'm
expert of, to be honest. As I was saying, using AuCTeX there's no
problem, because the compilation command is an elisp function that
checks which one of the two is needed. May that be helpful?

Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Friday, 13 May 2022 at 09:48, Bruce D'Arcus wrote:
> It's not undocumented; it's poorly documented :-)

I don't that's entirely fair... just a little sparse maybe. ;-) (but
your comment taken as intended)

I've made use of it recently and it had what I needed.

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Ihor Radchenko
"Bruce D'Arcus"  writes:

>> Last thing: I heard that the citation part of the manual is still
>> undocumented. Is this right? If so, do you think what we discovered
>> (especially about manually requiring libraries) may be useful? May I
>> help?
>
> It's not undocumented; it's poorly documented :-)
>
> https://orgmode.org/manual/Citation-handling.html#Citation-handling
>
> I don't know the process here on this, but definitely it needs improvements.

The process is just as any other patch. That is
https://orgmode.org/worg/org-contribute.html

Best,
Ihor



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 9:32 AM Alessandro Bertulli
 wrote:

> Last thing: I heard that the citation part of the manual is still
> undocumented. Is this right? If so, do you think what we discovered
> (especially about manually requiring libraries) may be useful? May I
> help?

It's not undocumented; it's poorly documented :-)

https://orgmode.org/manual/Citation-handling.html#Citation-handling

I don't know the process here on this, but definitely it needs improvements.

I'm not actually sure about the processor loading issue, given that it
should have been addressed months ago?

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Thanks, I'll mail to mr Collins to inform him then. Thank you all for
your help!

Last thing: I heard that the citation part of the manual is still
undocumented. Is this right? If so, do you think what we discovered
(especially about manually requiring libraries) may be useful? May I
help?

Thank you,
Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 9:15 AM Alessandro Bertulli
 wrote:

...

> So, shall we conclude that latexmk has an issue with correctly
> recognizing natbib and calling bibtex?

Yes!

I just tried it now, and see the same thing. It's weird, because I
don't recall seeing that before.

I'd call that a bug.

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
Ok, I think I got something.

Indeed, setting org-latex-pdf-process to

'("pdflatex -output-directory %o %f"
  "bibtex %b" "pdflatex -output-directory %o %f"
  "pdflatex -output-directory %o %f")

produces the correct pdf output. I think I have a hint of the reason for
this.

When exporting to a LaTeX file, and then compiling, the keybinding "C-c
C-a" invokes TeX-command-run-all, which in turn invokes
TeX-command-sequence, which in turn invokes TeX-command-default: this is an 
elisp function that
basically replaces the work of latexmk, checking the timestamps of files
and deciding wether to use bibtex or biber. Here's the snippet:
   (if (bound-and-true-p LaTeX-using-Biber)
   TeX-command-Biber TeX-command-BibTeX))

So, latexmk is never actually called!

The point is that natbib needs bibtex to be called: in fact setting
org-latex-pdf-process to manually call it produces the correct output,
and setting it to call biber instead produces the "(?)" (as well as an
empty .bbl file).

So, shall we conclude that latexmk has an issue with correctly
recognizing natbib and calling bibtex?

Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Bruce D'Arcus
On Fri, May 13, 2022 at 6:54 AM Eric S Fraga  wrote:
>
> On Friday, 13 May 2022 at 11:55, Alessandro Bertulli wrote:
> >> Check out org-latex-pdf-process maybe?
> >
> > I don't know the library so in depth, but I'll try, thank you!
>
> I have the following in my init file:
>
> (setq org-latex-pdf-process '("pdflatex -output-directory %o %f"
>   "bibtex %b"
>   "pdflatex -output-directory %o %f"
>   "pdflatex -output-directory %o %f"))
>
> which tells org to run pdflatex, then bibtex, and then pdflatex twice
> more to ensure that all references are satisfied.

I thought org now by default, if available, uses latexmk, which should
take care of all this?

At least, it does for me.

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Friday, 13 May 2022 at 11:55, Alessandro Bertulli wrote:
>> Check out org-latex-pdf-process maybe?
>
> I don't know the library so in depth, but I'll try, thank you!

I have the following in my init file:

(setq org-latex-pdf-process '("pdflatex -output-directory %o %f"
  "bibtex %b"
  "pdflatex -output-directory %o %f"
  "pdflatex -output-directory %o %f"))

which tells org to run pdflatex, then bibtex, and then pdflatex twice
more to ensure that all references are satisfied.

The default might not include bibtex...  I don't know.

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
> IDK; my version is newer:
> 
> Org mode version 9.6 (9.6-??-2bd34edb64 @
> /home/bruce/.config/emacs/.local/straight/build-29.0.50/org/)

I downloaded it from MELPA (since I'm using Emacs 28.1, the one built-in
is 9.5.2).

> I'm using doom, which as you can tell is using straight.

I suppose straight does all the loading automatically, then. No problem
so, I think.

Thank you!

Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Alessandro Bertulli
> For the record, n.d. means "no date" so your BiBTeX entry must be
> missing the year field, for instance.

Actually, it has the field "date". I have read some advice saying that
using "date" over "year", "month" and "day" is encouraged, but searching
online it appears that it is not supported by BiBTeX (and therefore
natbib), only by biblatex. So you're right, it's not a problem of org
export.

> Check out org-latex-pdf-process maybe?

I don't know the library so in depth, but I'll try, thank you!

Alessandro





Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-13 Thread Eric S Fraga
On Thursday, 12 May 2022 at 20:31, Alessandro Bertulli wrote:
> displays some annoing "n.d."). 

For the record, n.d. means "no date" so your BiBTeX entry must be
missing the year field, for instance.

> After that, if I try again to directly export to pdf, it works. I
> suppose it's a problem in producing the intermediate bibliography
> files.

Check out org-latex-pdf-process maybe?

-- 
: Eric S Fraga, with org release_9.5.3-481-gaea24b in Emacs 29.0.50



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-12 Thread Alessandro Bertulli
Hi Bruce,
thank you for your help. Indeed, loading both functionalities
(require 'oc-biblatex)
(require 'oc-natbib)
did the trick. That's strange, though: my version of Org (get from M-x
org-version) is Org mode version 9.5.3 (9.5.3-g69c588 @
/home/alessandro/.emacs.d/elpa/org-9.5.3/). Shouldn't it already be
fixed?

Moreover, I now encounter a different problem: biblatex works great, but
natbib doesn't. It's not a big problem, since I use biblatex, but here
it is, if someone is interested.

If I set up natbib as reference engine (with #+cite_export: natbib
kluwer), and I export to a pdf file (C-c C-e l o) the references are not
resolved, i.e. they are shown as "(?)". However, if I export to a LaTeX
file (C-c C-e l l), and then compile it, everyting is fine (although it
displays some annoing "n.d."). After that, if I try again to directly
export to pdf, it works. I suppose it's a problem in producing the
intermediate bibliography files.

Alessandro



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-12 Thread Bruce D'Arcus
On Thu, May 12, 2022 at 2:31 PM Alessandro Bertulli
 wrote:
>
> Hi Bruce,
> thank you for your help. Indeed, loading both functionalities
> (require 'oc-biblatex)
> (require 'oc-natbib)
> did the trick. That's strange, though: my version of Org (get from M-x
> org-version) is Org mode version 9.5.3 (9.5.3-g69c588 @
> /home/alessandro/.emacs.d/elpa/org-9.5.3/). Shouldn't it already be
> fixed?

IDK; my version is newer:

Org mode version 9.6 (9.6-??-2bd34edb64 @
/home/bruce/.config/emacs/.local/straight/build-29.0.50/org/)

I'm using doom, which as you can tell is using straight.

Bruce



Re: Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-12 Thread Bruce D'Arcus
On Thu, May 12, 2022 at 10:48 AM Alessandro Bertulli
 wrote:
>
> Hi again.
>
> After fixing org-ref, I was exploring org-cite and citar. Again, I'm not
> sure how to make everything work. When I try to export to a LaTeX pdf
> file, I got the error "user-error: Unknown processor natbib", despite
> I put the exact header suggested in the manual
> (https://orgmode.org/manual/Citation-export-processors.html).
> Note that the same happens if I put
> #+cite_export: biblatex
> in which case of course I get "user-error: Unknown processor biblatex".
>
> What am I doing wrong this time?

It just means org hasn't loaded that export processor.

There was a change a few months ago that should correctly autoload
processors in these situations. So assuming you're running an older
version, you have two options:

1. update your org
2. manually configure the oc-biblatex processor loading using require
or use-package

Bruce



Org-cite/Citar cannot recognize neither biblatex nor natbib

2022-05-12 Thread Alessandro Bertulli
Hi again.

After fixing org-ref, I was exploring org-cite and citar. Again, I'm not
sure how to make everything work. When I try to export to a LaTeX pdf
file, I got the error "user-error: Unknown processor natbib", despite
I put the exact header suggested in the manual
(https://orgmode.org/manual/Citation-export-processors.html).
Note that the same happens if I put
#+cite_export: biblatex
in which case of course I get "user-error: Unknown processor biblatex".

What am I doing wrong this time?

My setup:

init.el relevant config -
(require 'citar)
(setq org-cite-global-bibliography '("~/Library/debug.bib"))
(setq org-cite-insert-processor 'citar
  org-cite-follow-processor 'citar
  org-cite-activate-processor 'citar
  citar-bibliography org-cite-global-bibliography)
(define-key org-mode-map (kbd "C-c b") #'org-cite-insert)
(define-key minibuffer-local-map (kbd "M-b") #'citar-insert-preset)

~/Library/debug.bib 

@book{acm:code,
  title = {{{ACM}} Code of Ethics and Professional Conduct. {{Affirming}} Our 
Obbligation to Use Our Skills to Benefit Society},
  editor = {{Association for Computing Machinery}},
  date = {2018},
  doi = {10.1145/3274591},
  url = 
{https://www.acm.org/binaries/content/assets/about/acm-code-of-ethics-booklet.pdf},
  shorteditor = {ACM}
}

@article{acm:teachingethics,
  title = {How to Teach Computer Ethics through Science Fiction},
  author = {Burton, Emanuelle and Goldsmith, Judy and Mattei, Nicholas},
  date = {2018-07},
  journaltitle = {Communications of The Acm},
  shortjournal = {Commun. ACM},
  volume = {61},
  number = {8},
  pages = {54--64},
  publisher = {{Association for Computing Machinery}},
  location = {{New York, NY, USA}},
  issn = {0001-0782},
  doi = {10.1145/3154485},
  url = {https://doi.org/10.1145/3154485},
  abstract = {Science fiction in particular offers students a way to cultivate 
their capacity for moral imagination.},
  issue_date = {August 2018},
  pagetotal = {11}
}

org-cite.org -
#+title: Org-cite examples

#+bibliography:~/Library/debug.bib
#+cite_export: natbib kluwer

* First section
Some text [cite:@acm:teachingethics]

* Bibliography
#+print_bibliography:

--

Thanks for your help