Modifying in-text citation and bibliography with biblatex/biber (apa-style)

1,185

Point 2 should be as easy as

\DeclareFieldFormat*{pages}{\mkpageprefix[bookpagination]{#1}}

Point 1 is more complicated. Given that you are already deviating far from APA style, it might be worth a try to just load the standard authoryear style for citations

style           = apa,
citestyle       = authoryear,

The fact that you then still don't get "First Author et al." in your MWE is due to Set limit to one author when using "et al." in biblatex.

\documentclass[11pt,a4paper,toc=listof]{scrartcl}
\usepackage[left=3cm, right=2cm, bottom=3cm, top=2cm]{geometry}
\usepackage[english,ngerman]{babel} % Sprachpakete
\usepackage[utf8]{inputenc}         % Direkte Eingabe von Umlauten
\usepackage[T1]{fontenc}            % Worttrennung bei Umlauten
\usepackage{microtype}              % Verbesserter Randausgleich
% Anführungszeichen
\usepackage[
babel,
german=quotes,
german=guillemets
]{csquotes}
% ***** Bibliographie und Zitation *****
\usepackage[
style           = apa,
citestyle       = authoryear,
sorting         = nyt,
sortcites       = true,
autocite        = inline,
citetracker     = false,
maxbibnames     = 99,
maxcitenames    = 2,
backend         = biber,
bibliography    = totoc,
isbn            = false,
doi             = true,
urldate         = short
]{biblatex}
\DeclareFieldFormat{apacase}{#1}
\DefineBibliographyStrings{ngerman}{%
  andothers = {{et\,al\adddot}},
}
% remove comma in (Beadle and Tautum, 1941) This applies to citation only
\renewcommand*{\nameyeardelim}{\addspace}
% change delimiters
% since the delimiters use several contexts, some format clearing needs to happen
\DeclareDelimFormat*{multinamedelim}{\,/\,}
\DeclareDelimFormat*{finalnamedelim}{}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat*{finalnamedelim:apa:family-given}{}
\DeclareDelimAlias{finalnamedelim:apa:family-given}{multinamedelim}

% Umbrüche in URL und DOI bei Zahlen zulassen
\setcounter{biburlnumpenalty}{100}  % allow breaks at numbers
% Reihen in Bibliographie
\DeclareFieldFormat{number}{\bibstring{number}~#1}
% name sort always last, first
\DeclareNameAlias{editor}{family-given}

% Anpassungen um Schriftenreihe mit Nummer vor Ort und Verlag zu platzieren
\renewbibmacro*{addinfo}{%
    \ifthenelse{\iffieldundef{edition}\AND%
          \iffieldundef{chapter}\AND%
          \iffieldundef{volumes}\AND%
          \iffieldundef{pages}\AND%
          \(\iffieldundef{volume}\OR\boolean{bbx:volseen}\)}
    {}
    {\printtext{\bibopenparen}%
    \printfield{edition}%
    \setunit*{\addcomma\addspace}%
    \printfield{chapter}%
    \setunit*{\addcomma\addspace}%
    \notbool{bbx:volseen}%
    {\iffieldundef{volume}{}{\global\booltrue{bbx:volseen}}%
    \printfield{volume}%
    \iffieldundef{part}{}{\printfield{part}}}{}%
    \setunit*{\addcomma\addspace}%
    \printfield{volumes}%
    \setunit*{\addcomma\addspace}%
    \printfield{pages}%
    \setunit{}%
    \printtext{\bibcloseparen}%
    \newunit}}
\renewbibmacro*{maintitle+title}{%
    \iffieldsequal{maintitle}{title}
    {\clearfield{maintitle}%
    \clearfield{mainsubtitle}%
    \clearfield{maintitleaddon}}
    {\iffieldundef{maintitle}
    {}
    {\usebibmacro{maintitle}%
    \newunit\newblock
    \iffieldundef{volume}
     {}
     {\setunit{\global\booltrue{bbx:volseen}}%
      \printfield{volume}%
      \printfield{part}%
      \setunit{\adddot\space}}}}%
    \usebibmacro{title}%
    \newunit}
\renewbibmacro*{maintitle+booktitle}{%
 \ifthenelse{\iffieldundef{maintitle}\AND\iffieldundef{booktitle}}
{}
{\usebibmacro{in}%
 \iffieldundef{maintitle}
  {}
  {\usebibmacro{maintitle}%
   \newunit\newblock
   \iffieldundef{volume}
     {}
     {\setunit{\addspace\global\booltrue{bbx:volseen}}%
      \printfield{volume}%
      \printfield{part}%
      \setunit{\adddot\addspace}}}%
\usebibmacro{booktitle}}}
\renewbibmacro*{series+number}{%
    \printfield{series}%
    \setunit{\addcomma\space}%
    \printfield{number}%
    \newunit}
\usepackage{xpatch}
    \xpatchbibdriver{book}
    {\printfield{series}}
    {\usebibmacro{series+number}}
    {}{}
    \xpatchbibdriver{inbook}
    {\printfield{series}}
    {\usebibmacro{series+number}}
    {}{}
    \xpatchbibdriver{incollection}
    {\printfield{series}}
    {\usebibmacro{series+number}}
    {}{}
    \xpatchbibdriver{collection}
    {\printfield{number}}
    {}
    {}{}
    \xpatchbibdriver{collection}
    {\printfield{series}}
    {\usebibmacro{series+number}}
    {}{}
% Eintragsart Bericht (report) Anpassung
\DeclareFieldFormat[report]{number}{\bibcpstring{number}~\apanum{#1}}
    \renewbibmacro*{apa:reportnum}{%
    \newunit\newblock
    \printfield{type}%
    \setunit*{\addcomma\space}%
    \printfield{number}}
\xpatchbibdriver{report}
      {\printlist{institution}}
    {}
    {}{}
\newbibmacro*{location+institution}{%
    \printlist[default][1-1]{location}%
    \setunit*{\addcolon\space}%
    \printlist{institution}%
    \newunit}
\xpatchbibdriver{report}
    {\usebibmacro{location+publisher}}
    {\usebibmacro{location+institution}}
    {}{}
% bei allen Eintragsarten andere Editortypen missachten
\AtEveryBibitem{
    \iffieldequalstr{editortype}{redactor}
    {\global\clearname{editor}\typeout{delete editor (type: redactor) in \thefield{citekey}}}{}%
    \iffieldequalstr{editoratype}{redactor}
    {\global\clearname{editora}\typeout{delete editora (type: redactor) in \thefield{citekey}}}{}%
    \iffieldequalstr{editorbtype}{redactor}
    {\global\clearname{editorb}\typeout{delete editorb (type: redactor) in \thefield{citekey}}}{}%
    \iffieldequalstr{editorctype}{redactor}
    {\global\clearname{editorc}\typeout{delete editorc (type: redactor) in \thefield{citekey}}}{}%
    }
% Alle Zitate in Kurzform (ab 3 Autoren et al.), bereits ab erster Nennung


\renewcommand*{\subtitlepunct}{\addspace\textemdash\space}

\DeclareFieldFormat*{pages}{\mkpageprefix[bookpagination]{#1}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{Backhaus.etal_2015,
  langid    = {ngerman},
  location  = {Berlin},
  title     = {Fortgeschrittene Multivariate Analysemethoden},
  subtitle  = {Eine anwendungsorientierte Einf{\"u}hrung},
  edition   = {3., {\"u}berarb. u. akt. Aufl.},
  isbn      = {978-3-662-46086-3},
  publisher = {Springer Gabler},
  date      = {2015},
  author    = {Backhaus, Klaus and Erichson, Bernd and Weiber, Rolf}
}
@book{Backhaus.etal_2016,
  langid    = {ngerman},
  location  = {Berlin},
  title     = {Multivariate Analysemethoden},
  subtitle  = {Eine anwendungsorientierte Einf{\"u}hrung},
  edition   = {14., {\"u}berarb. u. akt. Aufl.},
  isbn      = {978-3-662-46075-7},
  publisher = {Springer Gabler},
  date      = {2016},
  author    = {Backhaus, Klaus and Erichson, Bernd and Plinke, Wulff and Weiber, Rolf}
}
@report{Revelle_2017b,
  langid      = {english},
  location    = {Evanston, IL},
  title       = {How To: {Use} the psych package for Factor Analysis and data reduction},
  url         = {http://personality-project.org/r/psych/HowTo/factor.pdf},
  institution = {Department of Psychology, Northwestern University},
  urldate     = {2018-07-01},
  date        = {2017},
  author      = {Revelle, William}
}
@incollection{Revelle.Condon_2018,
  langid       = {english},
  location     = {Chichester},
  title        = {Reliability},
  volume       = {2},
  isbn         = {978-1-118-48977-2},
  booktitle    = {The Wiley Handbook of Psychometric Testing},
  booksubtitle = {A Multidisciplinary Reference on Survey, Scale and Test Development},
  publisher    = {J.~Wiley \& Sons},
  date         = {2018},
  pages        = {709-749},
  author       = {Revelle, William and Condon, David M.},
  editor       = {Irwing, Paul and Booth, Tom and Hughes, David J.},
  doi          = {10.1002/9781118489772.ch23}
}
@article{Revelle.Zinbarg_2009,
  langid       = {english},
  title        = {Coefficients Alpha, Beta, Omega, and the {GLB}},
  subtitle     = {Comments on {Sijtsma}},
  volume       = {74},
  issn         = {0033-3123, 1860-0980},
  doi          = {10.1007/s11336-008-9102-z},
  number       = {1},
  journaltitle = {Psychometrika},
  date         = {2009},
  pages        = {145-154},
  author       = {Revelle, William and Zinbarg, Richard E.}
}
@article{Wright.Herrington_2011,
  langid       = {english},
  title        = {Problematic Standard Errors and Confidence Intervals for Skewness and Kurtosis},
  volume       = {43},
  issn         = {1554-3528},
  doi          = {10.3758/s13428-010-0044-x},
  number       = {1},
  journaltitle = {Behavior Research Methods},
  date         = {2011},
  pages        = {8-17},
  author       = {Wright, Daniel B. and Herrington, Joshua A.}
}
\end{filecontents}
\addbibresource{\jobname.bib}
% ******************* T E X T *******************%
\begin{document}
Source 1: \cite[8]{Wright.Herrington_2011}
Source 2: \cite[154]{Revelle.Zinbarg_2009}
Source 3: \cite{Revelle_2017b}
Source 4: \cite{Backhaus.etal_2016}
Source 5: \cite{Backhaus.etal_2015}
Source 6: \cite{Backhaus.etal_2016}
Source 7: \cite{Backhaus.etal_2015}
Source 8: \cite{Revelle.Condon_2018}

\printbibliography[title=Literaturverzeichnis]
\end{document}

Note how I changed your .bib entries. In particular the content of the langid field must be a language name known to babel.

enter image description here

Share:
1,185

Related videos on Youtube

Leandro
Author by

Leandro

Updated on July 24, 2020

Comments

  • Leandro
    Leandro over 3 years

    Concerning the citation and bibliography of my thesis, some issues I could solve myself, with others I got help. But here are two aspects, which I'd like to change, but I couldn't figure them out on my own:

    1. I'd like the abbreviation to »et al.« for more than two authors in all in-text citations, beginning with the first mention. Currently on first mention it will look like »Author A / Author B / Author C 2000« and from second mention like »Author A et al. 2000«. Is there a modification available?

    2. I'd like to add »S.« (german abbreviation for »Seite«, meaning »Page«) in all the citations of journals in the bibliography. It should look similar to book chapters. Is there a way to add that?

    I'm using APA-Style with biber as backend for biblatex. All help is much appreciated.

    MWE:

    \documentclass[11pt,a4paper,toc=listof]{scrartcl} 
    \usepackage[left=3cm, right=2cm, bottom=3cm, top=2cm]{geometry}
    \usepackage[english,ngerman]{babel} % Sprachpakete
    \usepackage[utf8]{inputenc}         % Direkte Eingabe von Umlauten
    \usepackage[T1]{fontenc}            % Worttrennung bei Umlauten
    \usepackage{microtype}              % Verbesserter Randausgleich
    \usepackage{textcomp}               % Zusätzliche Sonderzeichen
    \usepackage{graphicx}               % Einbindung Grafik
    % Anführungszeichen
    \usepackage[
    babel,
    german=quotes,
    german=guillemets
    ]{csquotes}                 
    % ***** Bibliographie und Zitation *****
    \usepackage[
    style           = apa,
    sorting         = nyt,
    sortcites       = true,
    autocite        = inline,
    maxbibnames     = 99,
    maxcitenames    = 2,
    backend         = biber,
    bibliography    = totoc,
    isbn            = false,
    doi             = true,
    urldate         = short
    ]{biblatex}
    \DeclareLanguageMapping{german}{german-apa}
    \DeclareFieldFormat{apacase}{#1}
    \DefineBibliographyStrings{ngerman}{%
    andothers = {{et\,al\adddot}},             
    }
    % remove comma in (Beadle and Tautum, 1941) This applies to citation only
    \renewcommand*{\nameyeardelim}{\addspace}
    % change delimiters
    \renewcommand*{\multinamedelim}[0]{\,/\,} 
    \renewcommand*{\finalnamedelim}[0]{\,/\,}
    \AtBeginBibliography{%
        \renewcommand*{\multinamedelim}[0]{\,/\,}% 
        \renewcommand*{\finalnamedelim}[0]{\,/\,}%
    }
    % Umbrüche in URL und DOI bei Zahlen zulassen
    \setcounter{biburlnumpenalty}{100}  % allow breaks at numbers
    % Reihen in Bibliographie
    \DeclareFieldFormat{number}{\bibstring{number}~#1}
    % name sort always last, first
    \AtBeginBibliography{%
    \DeclareNameAlias{editor}{last-first}
    }
    % Anpassungen um Schriftenreihe mit Nummer vor Ort und Verlag zu platzieren
    \renewbibmacro*{addinfo}{%
        \ifthenelse{\iffieldundef{edition}\AND%
              \iffieldundef{chapter}\AND%
              \iffieldundef{volumes}\AND%
              \iffieldundef{pages}\AND%
              \(\iffieldundef{volume}\OR\boolean{bbx:volseen}\)}
        {}
        {\printtext{\bibopenparen}%
        \printfield{edition}%
        \setunit*{\addcomma\addspace}%
        \printfield{chapter}%
        \setunit*{\addcomma\addspace}%
        \notbool{bbx:volseen}%
        {\iffieldundef{volume}{}{\global\booltrue{bbx:volseen}}%
        \printfield{volume}%
        \iffieldundef{part}{}{\printfield{part}}}{}%
        \setunit*{\addcomma\addspace}%
        \printfield{volumes}%
        \setunit*{\addcomma\addspace}%
        \printfield{pages}%
        \setunit{}%
        \printtext{\bibcloseparen}%
        \newunit}}
    \renewbibmacro*{maintitle+title}{%
        \iffieldsequal{maintitle}{title}
        {\clearfield{maintitle}%
        \clearfield{mainsubtitle}%
        \clearfield{maintitleaddon}}
        {\iffieldundef{maintitle}
        {}
        {\usebibmacro{maintitle}%
        \newunit\newblock
        \iffieldundef{volume}
         {}
         {\setunit{\global\booltrue{bbx:volseen}}%
          \printfield{volume}%
          \printfield{part}%
          \setunit{\adddot\space}}}}%
        \usebibmacro{title}%
        \newunit}
    \renewbibmacro*{maintitle+booktitle}{%
     \ifthenelse{\iffieldundef{maintitle}\AND\iffieldundef{booktitle}}
    {}
    {\usebibmacro{in}%
     \iffieldundef{maintitle}
      {}
      {\usebibmacro{maintitle}%
       \newunit\newblock
       \iffieldundef{volume}
         {}
         {\setunit{\addspace\global\booltrue{bbx:volseen}}%
          \printfield{volume}%
          \printfield{part}%
          \setunit{\adddot\addspace}}}%
    \usebibmacro{booktitle}}}
    \renewbibmacro*{series+number}{%
        \printfield{series}%
        \setunit{\addcomma\space}%
        \printfield{number}%
        \newunit}
    \usepackage{xpatch}
        \xpatchbibdriver{book}
        {\printfield{series}}
        {\usebibmacro{series+number}}
        {}{}
        \xpatchbibdriver{inbook}
        {\printfield{series}}
        {\usebibmacro{series+number}}
        {}{}
        \xpatchbibdriver{incollection}
        {\printfield{series}}
        {\usebibmacro{series+number}}
        {}{}
        \xpatchbibdriver{collection}
        {\printfield{number}}
        {}
        {}{}
        \xpatchbibdriver{collection}
        {\printfield{series}}
        {\usebibmacro{series+number}}
        {}{}
    % Eintragsart Bericht (report) Anpassung
    \DeclareFieldFormat[report]{number}{\bibcpstring{number}~\apanum{#1}}
        \renewbibmacro*{apa:reportnum}{%
        \newunit\newblock
        \printfield{type}%
        \setunit*{\addcomma\space}%
        \printfield{number}}
    \xpatchbibdriver{report}
          {\printlist{institution}}
        {}
        {}{}
    \newbibmacro*{location+institution}{%
        \printlist[default][1-1]{location}%
        \setunit*{\addcolon\space}%
        \printlist{institution}%
        \newunit}
    \xpatchbibdriver{report}
        {\usebibmacro{location+publisher}}
        {\usebibmacro{location+institution}}
        {}{}
    % bei allen Eintragsarten andere Editortypen missachten
    \AtEveryBibitem{
        \iffieldequalstr{editortype}{redactor}
        {\global\clearname{editor}\typeout{delete editor (type: redactor) in \thefield{citekey}}}{}%
        \iffieldequalstr{editoratype}{redactor}
        {\global\clearname{editora}\typeout{delete editora (type: redactor) in \thefield{citekey}}}{}%
        \iffieldequalstr{editorbtype}{redactor}
        {\global\clearname{editorb}\typeout{delete editorb (type: redactor) in \thefield{citekey}}}{}%
        \iffieldequalstr{editorctype}{redactor}
        {\global\clearname{editorc}\typeout{delete editorc (type: redactor) in \thefield{citekey}}}{}%
        }
    % Alle Zitate in Kurzform (ab 3 Autoren et al.), bereits ab erster Nennung
    \usepackage{filecontents}
    \begin{filecontents}{\jobname.bib}
    @book{Backhaus.etal_2015,
    langid = {Deutsch},
    location = {{Berlin}},
    title = {Fortgeschrittene Multivariate Analysemethoden \textemdash{} Eine anwendungsorientierte Einf{\"u}hrung},
    edition = {3., {\"u}berarb. u. akt. Aufl.},
    isbn = {978-3-662-46086-3},
    publisher = {{Springer Gabler}},
    date = {2015},
    author = {Backhaus, Klaus and Erichson, Bernd and Weiber, Rolf}
    }
    @book{Backhaus.etal_2016,
    langid = {Deutsch},
    location = {{Berlin}},
    title = {Multivariate Analysemethoden \textemdash{} Eine anwendungsorientierte Einf{\"u}hrung},
    edition = {14., {\"u}berarb. u. akt. Aufl.},
    isbn = {978-3-662-46075-7},
    publisher = {{Springer Gabler}},
    date = {2016},
    author = {Backhaus, Klaus and Erichson, Bernd and Plinke, Wulff and Weiber, Rolf}
    }
    @report{Revelle_2017b,
    langid = {Englisch},
    location = {{Evanston$\backslash$IL}},
    title = {How To: Use the psych package for Factor Analysis and data reduction},
    url = {http://personality-project.org/r/psych/HowTo/factor.pdf},
    institution = {{Department of Psychology, Northwestern University}},
    urldate = {2018-07-01},
    date = {2017},
    author = {Revelle, William}
    }
    @incollection{Revelle.Condon_2018,
    langid = {Englisch},
    location = {{Chichester}},
    title = {Reliability},
    volume = {2},
    isbn = {978-1-118-48977-2},
    volumes = {2},
    booktitle = {The Wiley Handbook of Psychometric Testing \textemdash{} A Multidisciplinary Reference on Survey, Scale and Test Development},
    publisher = {{J. Wiley \& Sons}},
    date = {2018},
    pages = {709-749},
    author = {Revelle, William and Condon, David M.},
    editor = {Irwing, Paul and Booth, Tom and Hughes, David J.},
    doi = {10.1002/9781118489772.ch23}
    }
    @article{Revelle.Zinbarg_2009,
    langid = {Englisch},
    title = {Coefficients Alpha, Beta, Omega, and the GLB \textemdash{} Comments on Sijtsma},
    volume = {74},
    issn = {0033-3123, 1860-0980},
    doi = {10.1007/s11336-008-9102-z},
    shorttitle = {Coefficients Alpha, Beta, Omega, and the glb},
    number = {1},
    journaltitle = {Psychometrika},
    date = {2009},
    pages = {145-154},
    author = {Revelle, William and Zinbarg, Richard E.}
    }
    @article{Wright.Herrington_2011,
    langid = {Englisch},
    title = {Problematic Standard Errors and Confidence Intervals for Skewness and Kurtosis},
    volume = {43},
    issn = {1554-3528},
    doi = {10.3758/s13428-010-0044-x},
    number = {1},
    journaltitle = {Behavior Research Methods},
    date = {2011},
    pages = {8-17},
    author = {Wright, Daniel B. and Herrington, Joshua A.}
    }
    \end{filecontents}
    \addbibresource{\jobname.bib}
    % ******************* T E X T *******************%
    \begin{document}
    Source 1: \cite[8]{Wright.Herrington_2011}
    Source 2: \cite[154]{Revelle.Zinbarg_2009}
    Source 3: \cite{Revelle_2017b}
    Source 4: \cite{Backhaus.etal_2016}
    Source 5: \cite{Backhaus.etal_2015}
    Source 6: \cite{Backhaus.etal_2016}
    Source 7: \cite{Backhaus.etal_2015}
    Source 8: \cite{Revelle.Condon_2018}
    \newpage
    \printbibliography[title=Literaturverzeichnis]
    \end{document}  
    
    • moewe
      moewe over 5 years
      Please ask only one question per question. That makes your question easier (and quicker) to answer and ensures that it is relevant for more people. See tex.meta.stackexchange.com/q/7425/35864
    • Leandro
      Leandro over 5 years
      Thanks for this information – you're right. Next time I'll split it up.
  • Leandro
    Leandro over 5 years
    Thanks for your answer – both points work perfectly. Your advice concerning the bib-entries is also much appreciated. I manage my literature with zotero (export bibliography, format: »better biblatex«) and so I'll replace the langid-fields for the whole bibliography as a last step, when the text is finished. I like your idea with the subtitle-fields, but as zotero doesn't offer this field, I can't use it and help myself with this »—«. With more than 200 entries I can't change that manually. Or is there a way to add this field in zotero?
  • moewe
    moewe over 5 years
    @Leandro I'm not a Zotero user myself, but if you use Better BibTeX, I believe you have (almost) full control over the fields and the export and it should be possible to export subtitle fields and the correct values for langid.
  • Leandro
    Leandro over 5 years
    I just noticed, that now (maybe because of citestyle=authoryear ?) printbibliography gives the following: (1) for two authors »Author, A. & Author, B.« instead of »Author, A. / Author, B.«, (2) for more authors »Author, A. / Author, B. & Author, C.« instead of always »/« as delimiter, (3) same goes for editors »A. Editor & B. Editor« instead of »A. Editor / B. Editor«, (4) and more »A. Editor / B. Editor & C. Editor« instead of always »/« as delimiter. Is there a way to fix that, too?
  • moewe
    moewe over 5 years
    @Leandro \DeclareDelimFormat[bib,biblist]{finalnamedelim:apa:family-g‌​iven}{\,/\,}
  • Leandro
    Leandro over 5 years
    thanks a lot, that worked perfectly for authors, but not for editors: they are still produced like »A. Editor & B. Editor«.
  • Leandro
    Leandro over 5 years
    Excuse me for asking again, but could you also give me an advice for the changing of the editors? @moewe
  • moewe
    moewe over 5 years
    @Leandro Check the update, please. The picture has not changed, but the code has.
  • Leandro
    Leandro about 5 years
    Unfortunately I just noticed, that for books and book-chapters the location and publisher are not shown, when there's a doi (in the example this is the case for Revelle / Condon 2018). Is there a way to solve this? It should look like it is now, but the end like this: [...] (Bd. 2, S. 709–749). Chichester: J. Wiley & Sons. doi:10.1002/9781118489772.ch23
  • moewe
    moewe about 5 years
    @Leandro My guess would be that this is an APA feature. I suggest you ask a new question about this with a short MWE.
  • Leandro
    Leandro about 5 years
    the new question is here: tex.stackexchange.com/questions/452228/…