emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [wip-cite-new] New natbib processor
@ 2021-05-05 14:53 Nicolas Goaziou
  2021-05-05 15:20 ` Bruce D'Arcus
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Nicolas Goaziou @ 2021-05-05 14:53 UTC (permalink / raw)
  To: Org Mode List

Hello,

Another thread! Yay!

I just added a new `natbib' processor in "wip-cite-new" branch, in the
file "oc-natbib.el"

--8<---------------cut here---------------start------------->8---
This library registers the `natbib' citation processor, which provides
the "export" capability for citations.

The processor relies on "natbib" LaTeX package. As such it ensures that
the package is properly required in the generated document. More
precisely, it will use any "\\usepackage{natbib}" command already
present in the document (e.g., through `org-latex-packages-alist'), or
insert one using options defined in `org-cite-natbib-options'.

It supports the following citation styles, in addition to the default
author-year format: "text" or "t", "author" or "a", "year" or "y".

It also supports the following sub-styles: "caps", "alt", and
"full".

Bibliography accepts any style supported by natbib package.
--8<---------------cut here---------------end--------------->8---

As noted, this processor implements "sub-styles", i.e. additional styles
separated with forward slash character. E.g.,

  [cite/text/alt/full:...]  => \citealt*{...}

  [cite//alt/caps:...]      => \Citealp{...}   (// means default style)

However, I'm not convinced by them. 

On the bright side, sub-styles can be put in any order, so we're
avoiding combinatorial explosion of commands.

However, they do not play well with shortcuts. For example, if shortcut
for "caps" is "C" and "full" is "F",

  [cite/text/caps/full:...] is equivalent to [cite/t/C/f:...]

which is not great. Also it introduces ambiguities in style inheritance.
For example, if I add

  #+cite_export: natbib plainnat text

would 

  [cite//alt/caps:...]

mean

  [cite/text/alt/caps:...]   (i.e., \Citealt{...})

or really

  [cite//alt/caps:]          (i.e., \Citealp{...})

?

I'd favor keeping only one level for styles is more reasonable. It means
implementing one style for each variant, e.g., "text-alt-caps" where the
order matters ("text-caps-alt" may not be supported), but it permits
more compact shortcuts, e.g., "Alt" for "text-alt-caps"). It also
eschews the inheritance pitfall above.

Also, completion front-ends can alleviate the burden of memorizing all
those styles.

Anyway, for now it's sub-styles. Please let me know what you think about
them, and about the processor, in general. I couldn't test it much
because the test bibliography I have is apparently "not compatible with
author-year citations".

As a reminder, to test it, you (require 'oc-natbib) to register the
processor, and add "#+cite_export: natbib" in your document (or set
`org-cite-export-processor' to (natbib)).

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2021-05-16  9:48 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 14:53 [wip-cite-new] New natbib processor Nicolas Goaziou
2021-05-05 15:20 ` Bruce D'Arcus
2021-05-05 15:32   ` Bastien
2021-05-06 12:29   ` Nicolas Goaziou
2021-05-06 12:56     ` Bruce D'Arcus
2021-05-05 18:08 ` Bruce D'Arcus
2021-05-05 21:25   ` Bruce D'Arcus
2021-05-05 21:40     ` Bruce D'Arcus
2021-05-05 22:32     ` Bruce D'Arcus
2021-05-06  7:36     ` Denis Maier
2021-05-06 10:06       ` Bruce D'Arcus
2021-05-06 11:22         ` Bruce D'Arcus
2021-05-06 12:05     ` Nicolas Goaziou
2021-05-06 13:09       ` Bruce D'Arcus
2021-05-06 14:12         ` Nicolas Goaziou
2021-05-06 14:23           ` Bruce D'Arcus
2021-05-06 16:20             ` Nicolas Goaziou
2021-05-06 16:59               ` Bruce D'Arcus
2021-05-06  8:47 ` Bruce D'Arcus
2021-05-06 12:11   ` Nicolas Goaziou
2021-05-06 12:37     ` Bruce D'Arcus
2021-05-07 11:37       ` Bruce D'Arcus
2021-05-08 13:51         ` Bruce D'Arcus
2021-05-09  8:57           ` Nicolas Goaziou
2021-05-09 13:49             ` Bruce D'Arcus
2021-05-09 20:25               ` Nicolas Goaziou
2021-05-09 22:01                 ` Bruce D'Arcus
2021-05-10 17:07                   ` Bruce D'Arcus
2021-05-10 20:22                     ` Nicolas Goaziou
2021-05-10 20:52                       ` Bruce D'Arcus
2021-05-15 21:29                   ` Nicolas Goaziou
2021-05-15 21:54                     ` Bruce D'Arcus
2021-05-16  9:47                       ` Nicolas Goaziou
2021-05-11 12:13 ` Eric S Fraga

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