emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-12 18:31 Alessandro Bertulli
  2022-05-12 18:38 ` Bruce D'Arcus
  2022-05-13  6:45 ` Eric S Fraga
  0 siblings, 2 replies; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-12 18:31 UTC (permalink / raw)
  To: bdarcus; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-12 18:31 Org-cite/Citar cannot recognize neither biblatex nor natbib Alessandro Bertulli
@ 2022-05-12 18:38 ` Bruce D'Arcus
  2022-05-13  6:45 ` Eric S Fraga
  1 sibling, 0 replies; 16+ messages in thread
From: Bruce D'Arcus @ 2022-05-12 18:38 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: org-mode-email

On Thu, May 12, 2022 at 2:31 PM Alessandro Bertulli
<alessandro.bertulli96@gmail.com> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-12 18:31 Org-cite/Citar cannot recognize neither biblatex nor natbib Alessandro Bertulli
  2022-05-12 18:38 ` Bruce D'Arcus
@ 2022-05-13  6:45 ` Eric S Fraga
  1 sibling, 0 replies; 16+ messages in thread
From: Eric S Fraga @ 2022-05-13  6:45 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: bdarcus, emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-13 17:20 Alessandro Bertulli
  0 siblings, 0 replies; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-13 17:20 UTC (permalink / raw)
  To: bdarcus, yantar92, e.fraga; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13 13:48 ` Bruce D'Arcus
  2022-05-13 14:07   ` Ihor Radchenko
@ 2022-05-13 15:42   ` Eric S Fraga
  1 sibling, 0 replies; 16+ messages in thread
From: Eric S Fraga @ 2022-05-13 15:42 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: Alessandro Bertulli, org-mode-email

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13 13:48 ` Bruce D'Arcus
@ 2022-05-13 14:07   ` Ihor Radchenko
  2022-05-13 15:42   ` Eric S Fraga
  1 sibling, 0 replies; 16+ messages in thread
From: Ihor Radchenko @ 2022-05-13 14:07 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: Alessandro Bertulli, org-mode-email

"Bruce D'Arcus" <bdarcus@gmail.com> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13 13:32 Alessandro Bertulli
@ 2022-05-13 13:48 ` Bruce D'Arcus
  2022-05-13 14:07   ` Ihor Radchenko
  2022-05-13 15:42   ` Eric S Fraga
  0 siblings, 2 replies; 16+ messages in thread
From: Bruce D'Arcus @ 2022-05-13 13:48 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: org-mode-email

On Fri, May 13, 2022 at 9:32 AM Alessandro Bertulli
<alessandro.bertulli96@gmail.com> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-13 13:32 Alessandro Bertulli
  2022-05-13 13:48 ` Bruce D'Arcus
  0 siblings, 1 reply; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-13 13:32 UTC (permalink / raw)
  To: bdarcus; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13 13:15 Alessandro Bertulli
@ 2022-05-13 13:20 ` Bruce D'Arcus
  0 siblings, 0 replies; 16+ messages in thread
From: Bruce D'Arcus @ 2022-05-13 13:20 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: Eric S Fraga, org-mode-email

On Fri, May 13, 2022 at 9:15 AM Alessandro Bertulli
<alessandro.bertulli96@gmail.com> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-13 13:15 Alessandro Bertulli
  2022-05-13 13:20 ` Bruce D'Arcus
  0 siblings, 1 reply; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-13 13:15 UTC (permalink / raw)
  To: e.fraga, bdarcus; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13 10:54 ` Eric S Fraga
@ 2022-05-13 11:03   ` Bruce D'Arcus
  0 siblings, 0 replies; 16+ messages in thread
From: Bruce D'Arcus @ 2022-05-13 11:03 UTC (permalink / raw)
  To: Org Mode List; +Cc: Alessandro Bertulli

On Fri, May 13, 2022 at 6:54 AM Eric S Fraga <e.fraga@ucl.ac.uk> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-13  9:55 Alessandro Bertulli
@ 2022-05-13 10:54 ` Eric S Fraga
  2022-05-13 11:03   ` Bruce D'Arcus
  0 siblings, 1 reply; 16+ messages in thread
From: Eric S Fraga @ 2022-05-13 10:54 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-13 10:01 Alessandro Bertulli
  0 siblings, 0 replies; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-13 10:01 UTC (permalink / raw)
  To: bdarcus; +Cc: emacs-orgmode

> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-13  9:55 Alessandro Bertulli
  2022-05-13 10:54 ` Eric S Fraga
  0 siblings, 1 reply; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-13  9:55 UTC (permalink / raw)
  To: e.fraga; +Cc: emacs-orgmode

> 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




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Org-cite/Citar cannot recognize neither biblatex nor natbib
  2022-05-12 14:48 Alessandro Bertulli
@ 2022-05-12 14:54 ` Bruce D'Arcus
  0 siblings, 0 replies; 16+ messages in thread
From: Bruce D'Arcus @ 2022-05-12 14:54 UTC (permalink / raw)
  To: Alessandro Bertulli; +Cc: emacs-orgmode

On Thu, May 12, 2022 at 10:48 AM Alessandro Bertulli
<alessandro.bertulli96@gmail.com> 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Org-cite/Citar cannot recognize neither biblatex nor natbib
@ 2022-05-12 14:48 Alessandro Bertulli
  2022-05-12 14:54 ` Bruce D'Arcus
  0 siblings, 1 reply; 16+ messages in thread
From: Alessandro Bertulli @ 2022-05-12 14:48 UTC (permalink / raw)
  To: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-05-13 17:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 18:31 Org-cite/Citar cannot recognize neither biblatex nor natbib Alessandro Bertulli
2022-05-12 18:38 ` Bruce D'Arcus
2022-05-13  6:45 ` Eric S Fraga
  -- strict thread matches above, loose matches on Subject: below --
2022-05-13 17:20 Alessandro Bertulli
2022-05-13 13:32 Alessandro Bertulli
2022-05-13 13:48 ` Bruce D'Arcus
2022-05-13 14:07   ` Ihor Radchenko
2022-05-13 15:42   ` Eric S Fraga
2022-05-13 13:15 Alessandro Bertulli
2022-05-13 13:20 ` Bruce D'Arcus
2022-05-13 10:01 Alessandro Bertulli
2022-05-13  9:55 Alessandro Bertulli
2022-05-13 10:54 ` Eric S Fraga
2022-05-13 11:03   ` Bruce D'Arcus
2022-05-12 14:48 Alessandro Bertulli
2022-05-12 14:54 ` Bruce D'Arcus

Code repositories for project(s) associated with this 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).