plk / biblatex-apa

APA style for BibLaTeX
90 stars 48 forks source link

Order of years in parenthetical citations of different articles by same authors #152

Closed pablobernabeu closed 2 years ago

pablobernabeu commented 2 years ago

Hello,

Thank you for this very helpful package.

I would like to report a minor bug. The years of publication are not ordered chronologically in parenthetical citations showing the same authors. For instance,

(Günther et al., 2021, 2018)

instead of

(Günther et al., 2018, 2021)

The bug does not seem to be affected by any of the following factors: reference tags used, order of reference tags in the Rmd, order of references in the .bib file.

I'm using the following configuration in the papaja manuscript:

csl:                apa.csl
documentclass:      apa7
classoption:        man

The bug can be reproduced using, for instance, the following references

Thank you very much for your attention


Somehow-related issue: #150

plk commented 2 years ago

This is technically correct as the two author lists are not the same and the 2021 item sorts before the 2018 one due to sorting being based firstly on the author list, not the year which is used to sort identical name lists.

pablobernabeu commented 2 years ago

Hi plk,

Thank you for your response. Please bear with me. I didn't fully understand your explanation.

The 2018 reference is:

Günther, F., Dudschig, C., & Kaup, B. (2018). Symbol grounding without direct experience: Do words inherit sensorimotor activation from purely linguistic context? Cognitive Science, 42, 336-374.

The 2021 reference is:

Günther, F., Press, S. A., Dudschig, C., & Kaup, B. (2021). The limits of automatic sensorimotor processing during word processing: Investigations with repeated linguistic experience, memory consolidation during sleep, and rich linguistic learning contexts. Psychological Research, 1-12.

If the order of the years in the parenthetical citation followed the alphabetical order in the reference list, the citation would be: (Günther et al., 2018, 2021).

moewew commented 2 years ago

With #150 addressed

\documentclass[american]{apa7}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=apa]{biblatex}

\shorttitle{Test}

\begin{filecontents}{\jobname.bib}
@article{guenther2018,
  author   = {Günther, Fritz and Dudschig, Carolin and Kaup, Barbara},
  title    = {Symbol Grounding Without Direct Experience},
  subtitle = {Do Words Inherit Sensorimotor Activation From Purely Linguistic Context?},
  journal  = {Cognitive Science},
  volume   = {42},
  number   = {S2},
  pages    = {336-374},
  doi      = {10.1111/cogs.12549},
  year     = {2018},
}
@article{guenther2021,
  author   = {Günther, Fritz and Press, Sophia Antonia
              and Dudschig, Carolin and Kaup, Barbara},
  title    = {The Limits of Automatic Sensorimotor Processing During Word Processing},
  subtitle = {Investigations with Repeated Linguistic Experience,
              Memory Consolidation During Sleep,
              and Rich Linguistic Learning Contexts},
  journal  = {Psychological Research},
  doi      = {10.1007/s00426-021-01620-4},
  year     = {2021},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{guenther2018,guenther2021}

Lorem \autocite{guenther2021,guenther2018}

\printbibliography
\end{document}

now gives

Lorem (Günther et al., 2018, 2021) Lorem (Günther et al., 2018, 2021)

screenshot of output demonstrated above

So I'm guessing this is fixed.

plk commented 2 years ago

Not sure this is the same example as the 2018 entry here sorts before the 2021 because of the name list?

moewew commented 2 years ago

the 2018 entry here sorts before the 2021 because of the name list?

Hmm, true. These are the .bib entries for the linked papers, though. But messing with the author list a bit gives

\documentclass[american]{apa7}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=apa]{biblatex}

\shorttitle{Test}

\begin{filecontents}[force]{\jobname.bib}
@article{guenther2018,
  author   = {Günther, Fritz and Dudschig, Carolin and Kaup, Barbara},
  title    = {Symbol Grounding Without Direct Experience},
  subtitle = {Do Words Inherit Sensorimotor Activation From Purely Linguistic Context?},
  journal  = {Cognitive Science},
  volume   = {42},
  number   = {S2},
  pages    = {336-374},
  doi      = {10.1111/cogs.12549},
  year     = {2018},
}
@article{guenther2021,
  author   = {Günther, Fritz and Aardvark, Sophia Antonia
              and Dudschig, Carolin and Kaup, Barbara},
  title    = {The Limits of Automatic Sensorimotor Processing During Word Processing},
  subtitle = {Investigations with Repeated Linguistic Experience,
              Memory Consolidation During Sleep,
              and Rich Linguistic Learning Contexts},
  journal  = {Psychological Research},
  doi      = {10.1007/s00426-021-01620-4},
  year     = {2021},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{guenther2018,guenther2021}

Lorem \autocite{guenther2021,guenther2018}

\printbibliography
\end{document}

Lorem (Günther et al., 2021, 2018) Lorem (Günther et al., 2021, 2018)

Screenshot of citation output above + bib entries

From what I read in #150 I'm guessing APA would want

Lorem (Günther et al., 2018, 2021) Lorem (Günther et al., 2018, 2021)

which would force citations and the bibliography to follow different sorting arrangements (the bib takes into account all names, the cites only "visible" names).


As for the original question I have the sneaking suspicion that @pablobernabeu may not be using biblatex-apa at all. indeed the csl: apa.csl suggests a CSL style is being used.

plk commented 2 years ago

This is not trivial as sortcites uses the currently in scope sorting scheme which for APA is a variant of nyt.

pablobernabeu commented 2 years ago

Thank you very much for your attention.

@moewew: Indeed, I had a csl. I have removed it, however, and found an identical result. Without the csl, I'm using biblatex-apa via the apa7 template.

plk commented 2 years ago

Looking into this but it is going to need biblatex, biber and APA style changes.

moewew commented 2 years ago

Maybe this is the right time to bring up my idea from a few years ago (https://github.com/plk/biblatex/issues/1009#issuecomment-637719314): For people who want different in-text and bibliography sorting it would really help to have a more lightweight alternative to refcontexts that does not recalculate any data, but only re-sorts based on the data available in the selected refcontext. Since we only need sorting, it would be enough to just output a sorted list of keys.

plk commented 2 years ago

That's what I'm looking at but it's not trivial. Also, these sorts of things usually need a general solution as they inevitably end up needing extension.

plk commented 2 years ago

This is working now but needs dev biblatex 3.18, dev biber 2.18 and the latest HEAD of the biblatex-apa master branch. It is not at all trivial, it turns out, as the way things work is that sorted data in the .bbl requires a refcontext section in the .bcf for the particular refsection and this only happens when \printbibliography/\printbiblist is used. This isn't the case for situations where only citations need to be sorted by a unique refcontext (in this case, one that uses a custom sorting name key template with a different name list visibility setting). So, I have added some general pieces to address this:

pablobernabeu commented 2 years ago

Thank you very much!

moewew commented 2 years ago

Sounds very promising. Hopefully I will have time to look at this in more detail and give it a spin next weekend.

moewew commented 2 years ago

@plk I had a look at the implementation of this new feature. It looks extremely useful. A few points occurred to me, though,

plk commented 2 years ago

It's a while ago I did that and those hooks were really just something to get it working quickly - I hadn't thought a lot about them to be honest so if you can look at that aspect, that would be good. I do have a vague feeling however that there was no way to localise the effect nicely.

The .bbl writing is a different matter - it will get very messy to have certain data lists only containing a subset of data - cites need names, years, extrayear etc. as all the data is pulled from the in-scope data list as well as that list being used for ordering. I fear we won't save much space in the end and it will all get very complex. The nice thing about the way it's done currently is that we know that we have all the data we could ever need in there for a given case. If we stop doing that, we bind biblatex and biber together more intimately in the sense that more fixes/requests are going to require changes in both and it's nice to have as many changes as possible only in biblatex. I think the cite visibility is relatively niche for the famously annoying APA style.

moewew commented 2 years ago

Sure, I'll have a look (my first instinct is that most things should work fine if we just use local definitions, but the devil is in the detail, or so they say), but it will have to wait until next weekend.

moewew commented 2 years ago

A local refcontext seems possible. See #181.

plk commented 2 years ago

This is nicer, thank you. Seems to work with the original MWE fine.

pablobernabeu commented 2 years ago

Thank you both very much!