plk / biblatex-apa

APA style for BibLaTeX
90 stars 48 forks source link

pubstate isn't been displayed #101

Closed bhopmann closed 4 years ago

bhopmann commented 4 years ago

When using pubstate with apa 9.9, its content isn't been displayed:

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

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

\begin{filecontents}[force]{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  date    = {2021},
  pubstate= {inpress},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\parencite{appleby}
\printbibliography
\end{document}

(Appleby, 2021)

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

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

\begin{filecontents}[force]{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  date    = {},
  pubstate= {inpress},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\parencite{appleby}
\printbibliography
\end{document}

(Appleby, n.d.)

moewew commented 4 years ago

I can't comment on what the output should look like, but here is one that works

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

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

\begin{filecontents}{\jobname.bib}
@book{appleby,
  author   = {Humphrey Appleby},
  title    = {On the Importance of the Civil Service},
  pubstate = {inpress},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\parencite{appleby}
\printbibliography
\end{document}

that's because apa.bbx explicitly removes pubstate if there is a year or date with a sourcemap

https://github.com/plk/biblatex-apa/blob/61abc1b008d20451a940041d6fc7ed22cc43b05a/tex/latex/biblatex-apa/bbx/apa.bbx#L353-L360

due to the way the sourcemap operates even empty fields (date = {},) are recognised as defined, so the pubstate is removed in both of your examples. (As a general note: It is almost always better not to give a field at all than to give it an empty value. I think the only reason to do that in BibTeX was to avoid field inheritance with crossref, not sure if that is even relevant with Biber.)

bhopmann commented 4 years ago

@moewew Thank you for your reply and the working example with its explanations. Since I'm exporting my bibliography from a reference manager (bookends), it's difficult to control, that some fields should not be displayed at all. Do you know a possibility to ignore the field year/date, if pubstate is given? Another way would be, to show both (e.g.: Appleby, 2021, in press).

moewew commented 4 years ago

You can get in with a \DeclareSourcemap of your own and remove the date and year if a pubstate is present before apa.bbx's \DeclareStyleSourcemap tries to remove pubstate if it sees date or year.

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

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

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=pubstate, final]
      \step[fieldset=year, null]
      \step[fieldset=date, null]
    }
  }
}

\begin{filecontents}{\jobname.bib}
@book{appleby,
  author   = {Humphrey Appleby},
  title    = {On the Importance of the Civil Service},
  date     = {2021},
  pubstate = {inpress},
}
@book{bppleby,
  author   = {Humphrey Bppleby},
  title    = {On the Importance of the Civil Service},
  date     = {},
  pubstate = {inpress},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{appleby,bppleby,sigfridsson}
\printbibliography
\end{document}

Displaying both pubstate and date would be a bit trickier I assume, especially if you want to have proper extradate values, because that would mean you have to involve Biber.

Again, I don't know what APA style expects here, so if you could find the relevant rules in the APA manual and check if current biblatex-apa behaviour is as expected, I'm sure PLK would appreciate it.

bhopmann commented 4 years ago

Since I do not own the current APA Manual, I've to relay on informations like this (Link).

(Appleby, in press)

So, the above written seems to be the common and according to APA also given way. Showing both date/year and pubstate seems to be not intended (even though I'm not shure). But it remains to be clarified whether BibTeX/Biber should ignore any given date/year field, if pubstate is given.

In the meantime I will stick with the solution you mentioned above:

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=pubstate, final]
      \step[fieldset=year, null]
      \step[fieldset=date, null]
    }
  }
}
plk commented 4 years ago

I don't know of any APA examples with pubstate and date since other mechanisms are used to indicate pre-prints etc.