emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* A minor suggestion about formatting citations
@ 2021-10-10 23:09 Vikas Rawal
  2021-10-11  7:38 ` Eric S Fraga
  2021-10-11  9:40 ` Nicolas Goaziou
  0 siblings, 2 replies; 9+ messages in thread
From: Vikas Rawal @ 2021-10-10 23:09 UTC (permalink / raw)
  To: org-mode mailing list

Date: Mon, 11 Oct 2021 04:36:56 +0530
From: Vikas Rawal <vikaslists@agrarianresearch.org>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: A minor suggestion about formatting citations
Organisation: CESP, Jawaharlal Nehru University, New Delhi

I find it works better for me if I insert spaces between multiple
citations. For example: [cite: @john56; @john35; @bruce2021] rather
than [cite:@john56;@john35;@bruce2021].

The of advantage is that if I am citing many references in one place,
and use fill-paragraph/auto-fill, they wrap nicely. As far as I can
see, having spaces in between works just fine.

If this does not break anything, should this be the recommended
practice for the org-cite-insert-processors?

Vikas


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

* Re: A minor suggestion about formatting citations
  2021-10-10 23:09 A minor suggestion about formatting citations Vikas Rawal
@ 2021-10-11  7:38 ` Eric S Fraga
  2021-10-11  9:40 ` Nicolas Goaziou
  1 sibling, 0 replies; 9+ messages in thread
From: Eric S Fraga @ 2021-10-11  7:38 UTC (permalink / raw)
  To: org-mode mailing list

On Monday, 11 Oct 2021 at 04:39, Vikas Rawal wrote:
> If this does not break anything, should this be the recommended
> practice for the org-cite-insert-processors?

+1

This would be good when using visual-line-mode as well.

thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-93-gd87250
: Latest paper written in org: https://arxiv.org/abs/2106.05096


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

* Re: A minor suggestion about formatting citations
  2021-10-10 23:09 A minor suggestion about formatting citations Vikas Rawal
  2021-10-11  7:38 ` Eric S Fraga
@ 2021-10-11  9:40 ` Nicolas Goaziou
  2021-10-11 13:38   ` Bruce D'Arcus
  1 sibling, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-10-11  9:40 UTC (permalink / raw)
  To: org-mode mailing list

Hello,

Vikas Rawal <vikasrawal@gmail.com> writes:

> I find it works better for me if I insert spaces between multiple
> citations. For example: [cite: @john56; @john35; @bruce2021] rather
> than [cite:@john56;@john35;@bruce2021].
>
> The of advantage is that if I am citing many references in one place,
> and use fill-paragraph/auto-fill, they wrap nicely. As far as I can
> see, having spaces in between works just fine.
>
> If this does not break anything, should this be the recommended
> practice for the org-cite-insert-processors?

Done, at least for insert processors relying on
`org-cite-make-insert-processor'. Thank you.

Regards,
-- 
Nicolas Goaziou


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

* Re: A minor suggestion about formatting citations
  2021-10-11  9:40 ` Nicolas Goaziou
@ 2021-10-11 13:38   ` Bruce D'Arcus
  2021-10-11 14:28     ` John Kitchin
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce D'Arcus @ 2021-10-11 13:38 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode mailing list

On Mon, Oct 11, 2021 at 5:40 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> Vikas Rawal <vikasrawal@gmail.com> writes:
>
> > I find it works better for me if I insert spaces between multiple
> > citations. For example: [cite: @john56; @john35; @bruce2021] rather
> > than [cite:@john56;@john35;@bruce2021].
> >
> > The of advantage is that if I am citing many references in one place,
> > and use fill-paragraph/auto-fill, they wrap nicely. As far as I can
> > see, having spaces in between works just fine.
> >
> > If this does not break anything, should this be the recommended
> > practice for the org-cite-insert-processors?
>
> Done, at least for insert processors relying on
> `org-cite-make-insert-processor'. Thank you.

There is one little issue I see.

Org-ref, and in turn org-ref-cite, have functions, attached via keymap
on the citation face, that allow one to shift the citation-references
within a citation.

I've borrowed some of that for oc-bibtex-actions as well.

So if I insert a citation using org-cite-insert, I get this:

[cite:@samers2002; @kohn2005]

If I then shift the right one left, I get this, which seems less than ideal:

[cite: @kohn2005;@samers2002;]

WDYT?

Bruce


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

* Re: A minor suggestion about formatting citations
  2021-10-11 13:38   ` Bruce D'Arcus
@ 2021-10-11 14:28     ` John Kitchin
  2021-10-11 14:54       ` Bruce D'Arcus
  0 siblings, 1 reply; 9+ messages in thread
From: John Kitchin @ 2021-10-11 14:28 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: org-mode mailing list, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]

you should probably trim each key, and re-add spaces where you want them in
the function that does these kinds of things. Maybe that should even be
controlled by a defcustom that allows 0-1 spaces.

John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Oct 11, 2021 at 9:38 AM Bruce D'Arcus <bdarcus@gmail.com> wrote:

> On Mon, Oct 11, 2021 at 5:40 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
> wrote:
> >
> > Hello,
> >
> > Vikas Rawal <vikasrawal@gmail.com> writes:
> >
> > > I find it works better for me if I insert spaces between multiple
> > > citations. For example: [cite: @john56; @john35; @bruce2021] rather
> > > than [cite:@john56;@john35;@bruce2021].
> > >
> > > The of advantage is that if I am citing many references in one place,
> > > and use fill-paragraph/auto-fill, they wrap nicely. As far as I can
> > > see, having spaces in between works just fine.
> > >
> > > If this does not break anything, should this be the recommended
> > > practice for the org-cite-insert-processors?
> >
> > Done, at least for insert processors relying on
> > `org-cite-make-insert-processor'. Thank you.
>
> There is one little issue I see.
>
> Org-ref, and in turn org-ref-cite, have functions, attached via keymap
> on the citation face, that allow one to shift the citation-references
> within a citation.
>
> I've borrowed some of that for oc-bibtex-actions as well.
>
> So if I insert a citation using org-cite-insert, I get this:
>
> [cite:@samers2002; @kohn2005]
>
> If I then shift the right one left, I get this, which seems less than
> ideal:
>
> [cite: @kohn2005;@samers2002;]
>
> WDYT?
>
> Bruce
>
>

[-- Attachment #2: Type: text/html, Size: 2727 bytes --]

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

* Re: A minor suggestion about formatting citations
  2021-10-11 14:28     ` John Kitchin
@ 2021-10-11 14:54       ` Bruce D'Arcus
  2021-10-11 15:54         ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce D'Arcus @ 2021-10-11 14:54 UTC (permalink / raw)
  To: John Kitchin; +Cc: org-mode mailing list, Nicolas Goaziou

On Mon, Oct 11, 2021 at 10:28 AM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>
> you should probably trim each key, and re-add spaces where you want them in the function that does these kinds of things.

I realize that's an option, but something about that feels wrong to me.

We're adding a single space as prefix, not because it's meaningful for
citation purposes (there actually is no prefix, though org-cite
interprets it as " "), but only so buffer formatting works correctly.

And then presumably code needs to be added to the export machinery to
strip those empty affixes?

Am not saying the latter goal isn't important; just seems like the
side effect isn't ideal.

> Maybe that should even be controlled by a defcustom that allows 0-1 spaces.

You mean in org-cite? I think that'd be my preference, unless there's
a better solution to this issue.

Bruce


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

* Re: A minor suggestion about formatting citations
  2021-10-11 14:54       ` Bruce D'Arcus
@ 2021-10-11 15:54         ` Nicolas Goaziou
  2021-10-11 16:55           ` Bruce D'Arcus
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-10-11 15:54 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: org-mode mailing list, John Kitchin

Hello,

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> On Mon, Oct 11, 2021 at 10:28 AM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>>
>> you should probably trim each key, and re-add spaces where you want them in the function that does these kinds of things.
>
> I realize that's an option, but something about that feels wrong to me.
>
> We're adding a single space as prefix, not because it's meaningful for
> citation purposes (there actually is no prefix, though org-cite
> interprets it as " "), but only so buffer formatting works correctly.

I don't think that's totally true. The additional space makes sense
typographically, in particular when some suffix is associated to the
key.

> And then presumably code needs to be added to the export machinery to
> strip those empty affixes?

I think they are ignored already. I didn't check though.

> Am not saying the latter goal isn't important; just seems like the
> side effect isn't ideal.
>
>> Maybe that should even be controlled by a defcustom that allows 0-1 spaces.
>
> You mean in org-cite? I think that'd be my preference, unless there's
> a better solution to this issue.

Org Cite is unrelated to this. One could as well have inserted spaces
manually, i.e., without calling `org-cite-insert' at all. The functions
responsible for swapping citations ought to cope with this situation
too.

Regards,
-- 
Nicolas Goaziou


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

* Re: A minor suggestion about formatting citations
  2021-10-11 15:54         ` Nicolas Goaziou
@ 2021-10-11 16:55           ` Bruce D'Arcus
  2021-10-13 12:51             ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce D'Arcus @ 2021-10-11 16:55 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode mailing list, John Kitchin

On Mon, Oct 11, 2021 at 11:54 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> "Bruce D'Arcus" <bdarcus@gmail.com> writes:
>
> > On Mon, Oct 11, 2021 at 10:28 AM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
> >>
> >> you should probably trim each key, and re-add spaces where you want them in the function that does these kinds of things.
> >
> > I realize that's an option, but something about that feels wrong to me.
> >
> > We're adding a single space as prefix, not because it's meaningful for
> > citation purposes (there actually is no prefix, though org-cite
> > interprets it as " "), but only so buffer formatting works correctly.
>
> I don't think that's totally true. The additional space makes sense
> typographically, in particular when some suffix is associated to the
> key.

Can you give an example of what you mean here? I can't think of one
off the top-of-my-head.

> > And then presumably code needs to be added to the export machinery to
> > strip those empty affixes?
>
> I think they are ignored already. I didn't check though.

I just checked, and believe you are correct.

> > Am not saying the latter goal isn't important; just seems like the
> > side effect isn't ideal.
> >
> >> Maybe that should even be controlled by a defcustom that allows 0-1 spaces.
> >
> > You mean in org-cite? I think that'd be my preference, unless there's
> > a better solution to this issue.
>
> Org Cite is unrelated to this. One could as well have inserted spaces
> manually, i.e., without calling `org-cite-insert' at all.

I know; but you changed the default behavior of org-cite-make-insert-processor.

The OP asked if there were any implications for this generally, and
I'm just saying "yes, there is."

You do have to trim the whitespace on either side of the key, since
the space is the delimiter. I guess it's not possible for the citation
parser to ignore the other whitespace?

> The functions responsible for swapping citations ought to cope with this situation
> too.

So check if the content of an affix, for example, is " " (rather than
whether there's an affix), and adjust accordingly?

Bruce


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

* Re: A minor suggestion about formatting citations
  2021-10-11 16:55           ` Bruce D'Arcus
@ 2021-10-13 12:51             ` Nicolas Goaziou
  0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2021-10-13 12:51 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: org-mode mailing list, John Kitchin

Hello,

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> On Mon, Oct 11, 2021 at 11:54 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

>> I don't think that's totally true. The additional space makes sense
>> typographically, in particular when some suffix is associated to the
>> key.
>
> Can you give an example of what you mean here? I can't think of one
> off the top-of-my-head.

I mean that it seems natural to write, e.g.,

 [cite:@doe21 p. 1; @doe99]

instead of 

  [cite:@doe21 p. 1;@doe99]

>> Org Cite is unrelated to this. One could as well have inserted spaces
>> manually, i.e., without calling `org-cite-insert' at all.
>
> I know; but you changed the default behavior of org-cite-make-insert-processor.
>
> The OP asked if there were any implications for this generally, and
> I'm just saying "yes, there is."

OK. Then, we are in a violent agreement. :)

> You do have to trim the whitespace on either side of the key, since
> the space is the delimiter. I guess it's not possible for the citation
> parser to ignore the other whitespace?

I'm not sure to understand your question. The space is not the
delimiter; the semicolon is.

For now, the whitespaces are significant for the parser, barring the
leading and trailing ones. It seemed useful for export back-end and
citation processor combinations unable to handle punctuation
automatically (e.g., HTML + oc-basic). I can't tell if they should be
ignored instead.

>> The functions responsible for swapping citations ought to cope with this situation
>> too.
>
> So check if the content of an affix, for example, is " " (rather than
> whether there's an affix), and adjust accordingly?

I don't think you need to check affixes when cycling citation
references. You could split at ";", trim, re-order, and re-build the
contents inserting "; " between each reference.

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2021-10-13 12:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-10 23:09 A minor suggestion about formatting citations Vikas Rawal
2021-10-11  7:38 ` Eric S Fraga
2021-10-11  9:40 ` Nicolas Goaziou
2021-10-11 13:38   ` Bruce D'Arcus
2021-10-11 14:28     ` John Kitchin
2021-10-11 14:54       ` Bruce D'Arcus
2021-10-11 15:54         ` Nicolas Goaziou
2021-10-11 16:55           ` Bruce D'Arcus
2021-10-13 12:51             ` Nicolas Goaziou

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