emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [wip-cite-new] New natbib processor


From: Bruce D'Arcus
Subject: Re: [wip-cite-new] New natbib processor
Date: Sun, 9 May 2021 18:01:44 -0400

On Sun, May 9, 2021 at 4:25 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> "Bruce D'Arcus" <bdarcus@gmail.com> writes:
>
> > To bottom line it, seems the decision comes down to something like
> > these three choices:
> >
> > 1. no change; keep sub-styles as they are ATM
> > 2. change sub-styles to a simple string. So [cite/text/caps+full:...],
> > where sub-style is the string "caps+full"; short cut would be
> > something like [cite:/t/c+f:...]
> > 3. remove sub-styles entirely; just have things like
> > [cite/text+caps-full:...], where the style is "text+caps-full"; or
> > with shortcuts [cite/t+c-f:...]
> >
> > Any of them seem reasonable to me.
> >
> > Maybe 2 is the best balance of flexibility and simplicity?
>
> But there are two 2 ;)

The nice thing about a wiki is one can always edit one's mistakes!

But I did correct the quoted text above, so I meant the first "2".

See below however ...

...

> Sub-styles buy us nicer switching between processors, indeed. But they
> come at a price, too. In particular, we need to re-define inheritance
> between styles defined in `org-cite-export-processor', "cite_export"
> keyword and the citation object. As I wrote earlier in this thread,
> there are multiple ways to deal with it, so a clear design is in order.
>
> Plain styles already exist. Sub-styles requires more work. Does the
> benefit outweigh it? If so, what do you suggest for the inheritance
> problem?

I guess the question is really about the logic in this function?

(defun org-cite-natbib--style-to-command (style)
  "Return command name to use according to STYLE string."
  (let ((base
         (if (org-cite-natbib--has-substyle-p style "caps")
             "Cite"
           "cite"))
        (alt
         (and (org-cite-natbib--has-substyle-p style "alt")
              "al"))
        (main (pcase (org-cite-natbib--main-style style)
                ((or "text" "t") "t")
                ((or "author" "a") "author")
                ((or "year" "y") "year")
                (_ "p")))
        (star
         (and (org-cite-natbib--has-substyle-p style "full")
              "*")))
    (concat "\\" base alt main star)))

My read of the natbib docs is this should work correctly, except for
the 'year' style, for which 'full' and 'caps' do not apply because
there are no authors output in those styles.

Indeed, if you do something like \Citeyear you will get an error from LaTeX.

So I think you need a conditional that ignores those for that style.

But otherwise, I think this should be fine.

The example you raised in the first post in this thread was the following:

> Also it introduces ambiguities in style inheritance.
> For example, if I add
>
>  #+cite_export: natbib plainnat text

So the default style is "text."

> would
>
>  [cite//alt/caps:...]
>
> mean
>
>  [cite/text/alt/caps:...]   (i.e., \Citealt{...})
>
> or really
>
>  [cite//alt/caps:]          (i.e., \Citealp{...})
>
> ?

First, I am thinking "bare" would be more clear than "alt", at least
if we're shooting for names that are clear outside the content of a
particular output format. WDYT?

On the more important output question, do not those two natbib
commands generate the same final output in the end?

As in, this ambiguity is in natbib itself?

That aside, I think just logically the first makes more sense, because
nowhere does the style or sub-styles specify the "citep" style.
Indeed, that style doesn't exist in the current list. This is what the
code currently produces.

Am I missing something there?

Bruce



reply via email to

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