plk/biblatex-apa

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

Closed this issue · 19 comments

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

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.

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

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

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

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

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

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

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

Maybe this is the right time to bring up my idea from a few years ago (plk/biblatex#1009 (comment)): 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

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

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:

  • A macro \GenRefcontextData to force writing of reference contexts to the .bcf regardless of whether a reference list is printed inside them
  • A new option to \DeclareSortingNamekeyTemplate to specify which name list visibility count to use when constructing name list sorting. This allows "cite" visibility instead of the default sorting visibility and since sorting name key templates are part of refcontexts, forces biber to generate complete sorted data lists for such scopes which means no extra messing about in biblatex. There is no lightweight way to do this, biber has to calculate an entirely separate sorted list of every key in the refsection for every refcontext needed because the refcontext parameters interact in such complex ways (in addition to interacting horribly with uniquename and uniquelist). This is fine though as it means that the .bbl is exhaustive and has all the data biblatex needs in an easily digested form.
  • Two new hooks \AfterEveryCite and \AtBeginRefsection to allow styles to automate all of this easily
  • All of this is used in the APA apa.bbx now

Thank you very much!

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

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

  • The new refcontext apa/apasortcite//global/global comes with all data in the .bbl, but that data is never used. The only thing that is used is the order of references. I was wondering if it would be possible to have Biber output only the sort order and no additional entry data. We could then avoid blowing up the .bbl file (reading a large .bbl can slow LaTeX down a bit, plus we have to save all the data). You say that Biber needs to do the calculations with the data (in the scheme I'm imagining that wouldn't be necessary, but that scheme might not be easy to pull off in the current Biber code framework), but maybe we could at least not output the data?
  • I'm a bit dubious about \AfterEveryCite. As discussed in plk/biblatex#352 and plk/biblatex#511, it is tricky to get the timing of these hooks right especially in a way that fits with the other hook setup. I'm wondering if we really need it here, though. Wouldn't it be possible to make the \newrefcontext that is issued in \AtEveryCite "local"? (I had a quick look at \newrefcontext and it does quite a few \xdefs, naively I'd have thought we might get away with making these \edefs to get a local version, but I'm not that familiar with the refcontext code. I can have a closer look, but I'm not sure if I can manage that this weekend.)
plk commented

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.

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.

A local refcontext seems possible. See #181.

plk commented

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

Thank you both very much!