TransWikia.com

Biblatex change citestyle mid document

TeX - LaTeX Asked on February 5, 2021

How can I change the citation style of biblatex mid-document?

I’m using biblatex apa style in combination with authoryear citestyle in Overleaf like this:

usepackage[style=apa,citestyle=authoryear,maxcitenames=2,mincitenames=1]{biblatex}
DeclareLanguageMapping{american}{american-apa}

I use different citation methods like textcite and parencite and the results look like this:

According to Howell (2013), the advantages …

… knee-joint (Shelton, 2014) or …

This is exactly what I want, however, for a classification in a table I would like to be able to cite by number as well, just like this:

[1]

This means that the apa style bibliography would need numbering and I would like to be able to switch between citation styles. Maybe define a new citation method, so that I can do something like this:

numbercite{Howell2013}

Is this possible? I appreciate any help. If I need another style in order to achieve the numbering that’s fine. Thanks in advance.

One Answer

In general it is not possible to mix different citation styles. But very often it is possible to cook something up that almost lets you have different citation styles.

In this case you can steal quite a lot of code from numeric.bbx and numeric.cbx.

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

usepackage[style=apa, labelnumber]{biblatex}

providebool{bbx:subentry}

% adapted from numeric.cbx
DeclareFieldFormat{entrysetcount}{mknumalph{#1}}

newbibmacro*{numcite}{%
  printtext[bibhyperref]{%
    printfield{labelprefix}%
    printfield{labelnumber}%
    ifbool{bbx:subentry}
      {printfield{entrysetcount}}
      {}}}

DeclareCiteCommand{numcite}[mkbibbrackets]
  {usebibmacro{prenote}}
  {usebibmacro{citeindex}%
   usebibmacro{numcite}}
  {multicitedelim}
  {usebibmacro{postnote}}

DeclareMultiCiteCommand{numcites}[mkbibbrackets]{numcite}{multicitedelim}

% adapted from numeric.bbx
DeclareBiblatexOption{global,type,entry}[boolean]{subentry}[true]{%
  setbool{bbx:subentry}{#1}}

DeclareFieldFormat{bibentrysetcount}{mkbibparens{mknumalph{#1}}}
DeclareFieldFormat{labelnumberwidth}{mkbibbrackets{#1}}
DeclareFieldFormat{shorthandwidth}{mkbibbrackets{#1}}

defbibenvironment{bibliography}
  {list
     {printtext[labelnumberwidth]{%
        printfield{labelprefix}%
        printfield{labelnumber}}}
     {setlength{labelwidth}{labelnumberwidth}%
      setlength{leftmargin}{labelwidth}%
      setlength{labelsep}{biblabelsep}%
      addtolength{leftmargin}{labelsep}%
      setlength{itemsep}{bibitemsep}%
      setlength{parsep}{bibparsep}}%
      renewcommand*{makelabel}[1]{hss##1}}
  {endlist}
  {item}

addbibresource{biblatex-examples.bib}


begin{document}
Lorem autocite{sigfridsson}
ipsum autocite{nussbaum}
dolor autocite{geer}

begin{tabular}{lr}
A & numcite{sigfridsson}
B & numcite{worman}
end{tabular}

printbibliography
end{document}

Lorem (Sigfridsson & Ryde, 1998) ipsum (Nussbaum, 1978) dolor (Geer, 1985)//A [3]//B [4]

As you can see, conceptually this combination is a bit tricky. The numbering makes the author and year far less prominent. If your primary way of referencing is still APA's author-year style, you are going to have a lot of unnecessary and possibly distracting numbers in the bibliography that take away focus from what is important for your readers: author and year.

Answered by moewe on February 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP