jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.81k stars 3.39k forks source link

Expose AuthorOnly as CitationMode #8331

Open rgaiacs opened 2 years ago

rgaiacs commented 2 years ago

Academic writing has two ways to provide citations: author-prominent and information-prominent.

Example of author-prominent:

Knuth et al. (1997) wrote a famous book.

Example of information-prominent:

A popular programming language is R (R Core Team, 2020).

Use of one over the other is a matter of field and writing style.

Citation Style Language 1.0.2 only support information-prominent, see https://github.com/jgm/citeproc/issues/69#issuecomment-849753083. This means that write using author-prominent format is annoying when using a numeric citation style (for example, IEEE) because name of authors need to be hard coded. For example, the Markdown

@knuth wrote a famous book.

will be render by Pandoc as

[1] wrote a famous book.

instead of

Knuth et al. (1997) wrote a famous book [1].

or similar variation and the user need to have in the Markdown

Knuth et al. (1997) wrote a famous book [@knuth].

As mentioned before, Citation Style Language doesn't support information-prominent and will be hard for Pandoc to support all different journal styles. One way to compromise is to provide Markdown syntax for author-only citations (already proposed in https://github.com/jgm/pandoc/issues/7258). Until https://github.com/jgm/pandoc/issues/7258 is resolved, would be great to facilitate the use of filters by Pandoc users. For example, Pandoc implements author-prominent "by emitting AuthorOnly and SuppressAuthor in sequence", see https://github.com/jgm/pandoc/blob/751383f33370928c7576f17d1a85d48cc9e8e30e/src/Text/Pandoc/Citeproc.hs#L335-L344

As a user, I would love to replace my use of AuthorInText with AuthorOnly. For example, the Markdown

@knuth [-@knuth] wrote a famous book [@knuth].

could be converted to

Knuth et al. (1997) wrote a famous book [1].

by calling

$ pandoc \
    --from markdown \
    --citeproc \
    --bibliography=references.bib \
    --csl=ieee.csl \
    mwe.md \
    --to json | \
    sed 's/AuthorInText/AuthorOnly/g' | \
    pandoc \
    --from json \
    --citeproc \
    --bibliography=references.bib \
    --csl=ieee.csl \
    --to html

Limitations

Based on my experiments, AuthorOnly is empty for Citation Style Language's numeric citation style.

bdarcus commented 5 months ago

I've also known this, in the academic literature on citation practices, to be called integral vs non-integral.

In any case, it seems that pandoc does support this, just perhaps not consistently (not with numeric styles)?