emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Denis Maier <denis.maier.lists@mailbox.org>
To: Org Mode List <emacs-orgmode@gnu.org>, Bruce D'Arcus <bdarcus@gmail.com>
Subject: Re: [wip-cite-new] Adjust punctuation around citations
Date: Sun, 16 May 2021 23:29:19 +0200	[thread overview]
Message-ID: <81051f87-a90e-56ed-7867-d6179ec1e9ad@mailbox.org> (raw)
In-Reply-To: <87sg2orz0z.fsf@nicolasgoaziou.fr>

Am 15.05.2021 um 13:56 schrieb Nicolas Goaziou:
> Hello,
> 
[...]
> 
> At the moment, the `org-cite-adjust-punctuation' function is designed
> with author-year to note conversion in mind, not the other way. I don't
> have enough examples of the opposite transformation to even be sure the
> current interface would be appropriate. I even believe this is not often
> possible, as it would imply rewording, i.e., add information that is not
> present in the original document.
> 
> This doesn't seem to be a limitation, though. This feature is useful for
> users having to switch between author-year and note styles. The rule of
> thumb is to always write author-year in source.

Well, I have to admit I was a bit confused when I first read this since 
the examples we're currently working with wouldn't be correct examples 
for author-date citations in German and English:

--8<---------------cut here---------------start------------->8---
#+language: de
#+cite_export: test

1. "This is a complete sentence." [cite:@key]

2. "This is an incomplete sentence" [cite:@key].

3. This is a complete sentence. [cite:@key]

4. This is an incomplete sentence [cite:@key].
--8<---------------cut here---------------end--------------->8---

In German and English author-date styles example 1. and 2. will both be 
rendered as:
"This is a complete sentence" (author year).
"This is an incomplete sentence" (author year).
So, in both cases the punctuation comes after the citation.

After looking up a few guidelines from French speaking universities in 
Canada, it looks like in French you'll actually render these citations as:
"This is a complete sentence." (author year)
"This is an incomplete sentence" (author year).
(Don't know if that is consistent across la francophonie.)
I.e., with a complete sentence you'll have the final punctuation inside 
the quotation marks with the citation following the citation. So, as you 
say the location of the punctuation is semantically meaningful in French 
even with author-date styles, but that isn't the case in German and 
English. In German and British English, the location of the punctuation 
is only semantically meaningful with note citation styles.

Now, interestingly, the way you'll place the punctuation marks in German 
and British English seems to conform to French author-date punctuation 
placement.

This means that in German and British English a conversion from
"This is a complete sentence." [cite:@key]
to
"This is a complete sentence" (citation).
is actually not adding, but removing information.

OTOH, if you write targeting German/English author-date styles, it's not 
possible to switch correctly to a note style in German and British 
English. (You'll have to indicate the location of the punctuation in the 
original material, which means it has to be moved when targeting an 
author-year style.)

So, I still think (outside outside before) should work in general for 
English and German. If I understand correctly you've already added it as 
  (pcase style ("author-year" ...
Correct?

There's only one further complication: if the quotation is a set off 
block quote, the citation comes after the punctuation mark:
This is a complete sentence. (author year)
Can surrounding context be considered in that transformation?

Denis

> 
> In any case, this explains why the docstring has a bias. I updated it to
> insist on the fact that these are rules for author-year to note
> conversion.
> 
> Also, this function is not meant to be accessible to the end user. It is
> called from the processor, which knows the type (or style) of the
> citation. It may also choose not to use this function. So, I agree with
> Bruce D'Arcus: selecting an appropriate rule and punctuation ought to
> happen at that level.
> 
> More importantly, I don't think fine-grain configuration is required.
> For specific needs, this "smart" feature should be disabled, and
> elements (punctuation, citation) positioned manually. But, again, if
> configuration is needed, the processor should provide it, e.g., through
> variables, not Org Cite. For example, a defcustom could offer to 1) not
> use this feature 2) rely on "language" keyword 3) apply a user-defined
> rule and punctuation set.
> 
> What would be nice, however, would be an association between language
> and default rules and punctuation characters.
> 
> WDYT?
> 
> Meanwhile, I modified `org-cite-adjust-punctuation' function a bit. Here
> is its new docstring.
> 
> --8<---------------cut here---------------start------------->8---
> Adjust punctuation around CITATION object.
> 
> When CITATION follows a quotation, or when there is punctuation next to it,
> the function tries to normalize the location of punctuation and citation
> according to some RULE.
> 
> RULE is a triplet of symbols (PUNCTUATION CITE ORDER):
> 
>    PUNCTUATION is the desired location of the punctuation with regards to the
>    quotation, if any.  It may be `inside', `outside', or`static'.  When set to
>    `static', the punctuation is not moved.
> 
>    CITE is the desired location of the citation with regards to the quotation
>    mark, if any.  It may be `inside', `outside', or `same'.  When set to `same',
>    the citation is moved on the same side as the punctuation, but does not move
>    if there is punctuation on both sides or on none.
> 
>    ORDER is the relative position of the citation with regards to the closest
>    punctuation.  It may be `after' or `before'.
> 
> For example, when changing from author-date to note style,
> 
>    (inside outside after) corresponds to American typography;
>    (static outside after) corresponds to German typography;
>    (static same before) corresponds to French typography.
> 
> INFO is the export state, as a property list.
> 
> Optional argument PUNCT is a list of punctuation marks to be considered.
> When nil, it includes the following: \".\" \",\" \";\" \":\" \"!\" and \"?\".
> 
> When optional argument ADD-SPACE is non-nil, add a space before citation.  This
> is useful, for example, when switching from note to author-year style.
> 
> Parse tree is modified by side-effect.
> 
> Note: if you are calling both `org-cite-adjust-punctuation' and
> `org-cite-wrap-citation' on the same object, call `org-cite-adjust-punctuation'
> first.
> --8<---------------cut here---------------end--------------->8---
> 
> Note that previous `strict' became `static', and I introduced a `same'
> value for the second rule.  I also added a new ADD-SPACE optional
> argument as an attempt to ease note to author-year style conversion.
> 
> As written already in another message, you can test the following
> updated processor:
> 
> --8<---------------cut here---------------start------------->8---
> (defun org-test--language-to-rule (info)
>    (pcase (plist-get info :language)
>      ("en-us" '(inside outside after))
>      ((or "en" "de" "en-gb") '(static outside after))
>      ("fr" '(static same before))
>      (_ nil)))
> 
> (defun org-test-export-citation (citation style _backend info)
>    (pcase style
>      ("author-year"
>       (org-cite-adjust-punctuation citation '(outside outside before) info nil t)
>       "(John Doe, 1999)")
>      (_
>       (pcase (org-test--language-to-rule info)
>         (`nil nil)
>         (rule (org-cite-adjust-punctuation citation rule info)))
>       (unless (org-cite-inside-footnote-p citation)
>         (org-cite-wrap-citation citation info))
>       "...")))
> 
> (org-cite-register-processor 'test
>    :export-citation #'org-test-export-citation)
> --8<---------------cut here---------------end--------------->8---
> 
> 
> Regards,
> 



  parent reply	other threads:[~2021-05-16 21:30 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13 21:33 Nicolas Goaziou
2021-05-13 22:14 ` Denis Maier
2021-05-13 23:21 ` Bruce D'Arcus
2021-05-14  8:31   ` Denis Maier
2021-05-14 10:26   ` Nicolas Goaziou
2021-05-14 12:37     ` Bruce D'Arcus
2021-05-14  8:42 ` Denis Maier
2021-05-14 12:28   ` Bruce D'Arcus
2021-05-15 11:56   ` Nicolas Goaziou
2021-05-15 12:03     ` Bruce D'Arcus
2021-05-15 12:43       ` Bruce D'Arcus
2021-05-16 21:29     ` Denis Maier [this message]
2021-05-16 21:38       ` Bruce D'Arcus
2021-05-16 22:03         ` Denis Maier via General discussions about Org-mode.
2021-05-16 22:24           ` Bruce D'Arcus
2021-05-17  8:08             ` Denis Maier
2021-06-05 21:35               ` Nicolas Goaziou
2021-06-05 21:45                 ` Bruce D'Arcus
2021-06-05 22:00                   ` Denis Maier
2021-06-12  9:39                     ` Nicolas Goaziou
2021-06-12 21:41                       ` Bruce D'Arcus
2021-06-12 22:04                         ` Nicolas Goaziou
2021-06-12 22:12                           ` Bruce D'Arcus
2021-06-13  8:22                           ` Denis Maier
2021-06-13 21:54                       ` Denis Maier
2021-06-13 22:04                         ` Bruce D'Arcus
2021-06-13 22:23                           ` Denis Maier
2021-06-13 22:47                             ` Bruce D'Arcus
2021-06-14 11:45                               ` Denis Maier
2021-06-14 11:51                                 ` Denis Maier
2021-06-14 23:37                                 ` Bruce D'Arcus
2021-06-14 23:41                                   ` Bruce D'Arcus
2021-06-20  7:41                                   ` Nicolas Goaziou
2021-06-20 16:37                                     ` Bruce D'Arcus
2021-06-20 17:17                                       ` Nicolas Goaziou
2021-06-21  8:12                                     ` Denis Maier
2021-06-21  8:45                                       ` Nicolas Goaziou
2021-06-21  9:49                                         ` Denis Maier
2021-06-21 10:07                                         ` Denis Maier
2021-05-14 13:39 ` Denis Maier
2021-05-15 11:43   ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81051f87-a90e-56ed-7867-d6179ec1e9ad@mailbox.org \
    --to=denis.maier.lists@mailbox.org \
    --cc=bdarcus@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [wip-cite-new] Adjust punctuation around citations' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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