1

As Pidrittel asked already here I need ibid in apa-style. The answer by moewe is already close to what I need. Just one additional aspect is missing. When an ibid is used and the citation before quotes the same page, the page shall not be printed.

  • The code from the answer throws errors with both a current version of biblatex-apa and biblatex-apa6. Can you please tell us which biblatex-apa version you are using? (Run a simple document using biblatex-apa and add \listfiles to the top of the document. Then check the .log file for the reported package version. Alternatively, you can search through the .log file without \listfiles and try to hunt down the version.) – moewe Jul 25 '20 at 12:40
  • @moewe Do you mean this line? File: apa.dbx 2020/04/08 v9.9 APA biblatex style data model – Björn Bause-Engel Jul 25 '20 at 12:51
  • Yeah, that's the one. I have 2020/05/30 v9.13 APA I can write an answer, but it will only be tested with that version. I broadly expect things to work, but there could be one or two rough edges we'll have to look at. – moewe Jul 25 '20 at 12:53

1 Answers1

1

The answer to Getting ibid for apa-style citations from biblatex was based on an older version of biblatex-apa.

This is the solution from there updated to a current version of biblatex-apa (2020/05/30 v9.13) plus the code for the ibidpage option, which can be taken directly from authoryear-ibid.cbx (basically all the code that involves loccit below is code for that option).

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa, pagetracker, ibidtracker=constrict]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter \newbool{cbx:loccit}

\DeclareBibliographyOption[boolean]{ibidpage}[true]{% \ifstrequal{#1}{true} {\ExecuteBibliographyOptions{loccittracker=constrict}} {\ExecuteBibliographyOptions{loccittracker=false}}}

\providecommand*{\mkibid}[1]{#1}

\newbibmacro*{cite:ibid}{% \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}% \ifloccit {\global\booltrue{cbx:loccit}} {}}

\renewbibmacro*{cite}{% \global\boolfalse{cbx:loccit}% \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage} {\usebibmacro{cite:ibid}} {\iffieldequals{fullhash}{\cbx@lasthash} % Multiple cites in one command {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}}% % Single cite {\ifnameundef{labelname} % No author/editor {\usebibmacro{cite:noname}% \setunit{\printdelim{nameyeardelim}}% \usebibmacro{cite:plabelyear+extradate}% \savefield{fullhash}{\cbx@lasthash}} % Normal cite {\ifnameundef{shortauthor} {\printnames{labelname}}% {\cbx@apa@ifnamesaved {\printnames{shortauthor}} {\ifnameundef{groupauthor} {\printnames[labelname]{author}} {\printnames[labelname]{groupauthor}}% \addspace\printnames[sabrackets]{shortauthor}}}% \setunit{\printdelim{nameyeardelim}}% \usebibmacro{cite:plabelyear+extradate}% \savefield{fullhash}{\cbx@lasthash}}}% \setunit{\multicitedelim}}}

\renewbibmacro*{textcite}{% \global\boolfalse{cbx:loccit}% \iffieldequals{fullhash}{\cbx@lasthash} % Compact cite - more than one thing for same author {\setunit{\compcitedelim}% \usebibmacro{cite:plabelyear+extradate}} % New cite {\ifbool{cbx:parens} {\bibcloseparen\global\boolfalse{cbx:parens}} {}% \setunit{\textcitedelim}% \ifnameundef{labelname} % No author/editor {\iffieldundef{shorthand}% % Cite using title {\usebibmacro{cite:noname}% \setunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}% \usebibmacro{cite:plabelyear+extradate}} % Cite using shorthand {\usebibmacro{cite:shorthand}}} % Normal cite with author/editor % Normal full cite {\ifnameundef{shortauthor}% % Normal full cite {\printnames{labelname}} % Cite using short author {\cbx@apa@ifnamesaved {\printnames{shortauthor}} {\ifnameundef{groupauthor} {\printnames[labelname]{author}} {\printnames[labelname]{groupauthor}}}}% % Year \setunit{\global\booltrue{cbx:parens}\addspace\bibopenparen}% % Put the shortauthor inside the year brackets if necessary \ifnameundef{shortauthor} {} {\cbx@apa@ifnamesaved {} {\printnames{shortauthor}% \setunit{\printdelim{nameyeardelim}}}}% % Print prenote (belongs to first cite) \ifnumequal{\value{citecount}}{1} {\usebibmacro{prenote}} {}% % Actual year printing \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage} {\usebibmacro{cite:ibid}} {\usebibmacro{cite:plabelyear+extradate}}% % Save name hash for checks later \savefield{fullhash}{\cbx@lasthash}}% \stepcounter{textcitecount}}}

\letbibmacro{orig:postnote}{postnote}

\renewbibmacro*{postnote}{% \ifbool{cbx:loccit} {} {\usebibmacro{orig:postnote}}} \makeatother

\ExecuteBibliographyOptions{ibidpage=true}

\begin{document} First citation should be normal \parencite{sigfridsson}, second time with ibidem \parencite{sigfridsson}, but after a second citation \parencite{geer} it should appear as usual \parencite{sigfridsson}.

\cite{nussbaum}

\autocite[3]{sigfridsson}

\autocite[4]{sigfridsson}

\autocite[4]{sigfridsson}

\cite{nussbaum}

First citation should be normal \textcite{sigfridsson}, second time with ibidem \textcite{sigfridsson}, but after a second citation \textcite{geer} it should appear as usual \textcite{sigfridsson}.

\printbibliography \end{document}

(Sigfridsson & Ryde, 1998, S. 3)//(ebd., S. 4)//(ebd.)

moewe
  • 175,683