TransWikia.com

Replace 'and' with ampersand in bibliography and parenthetical citations using BibLaTeX

TeX - LaTeX Asked by itpetersen on April 8, 2021

By default, author-year style in BibLaTeX uses the word ‘and’ before the last author. I would like to retain this for in-text citations, but would like to replace ‘and’ with an ampersand (&) in the bibliography and in parenthetical citations.

For example, I would like the following:

In-text citation: Smith and John (2013)
Parenthetical citation: (Smith & John, 2013)
Bibliography: Smith, A.B. & John, C.D. (2013)...

How can I do this? I found another answer that specified how to turn all instances of ‘and’ to ampersand, but I haven’t been able to find out how to change only the bibliography and parenthetical citations to ampersand (not the in-text citations):

Use ampersand & in citations and bibliography in biblatex

2 Answers

Using the code in the linked answer, this is what you can do.

To replace and with & in the bibliography you can simply insert that code inside AtBeginBibliography:

AtBeginBibliography{%
  renewcommand*{finalnamedelim}{%
    ifnumgreater{value{liststop}}{2}{finalandcomma}{}%
    addspace&space}%
}

The second request is a bit more complicated, in my opinion. Supposing you are using parencite for parenthetical citations, you can redefine that command in this way:

letorigparenciteparencite
renewrobustcmd{parencite}{%
  AtNextCite{%
  renewcommand*{finalnamedelim}{%
    ifnumgreater{value{liststop}}{2}{finalandcomma}{}%
    addspace&space}%
  }%
  origparencite%
}

AtNextCite ensures that and is changed to & only for the current citation command.

MWE (borrowed from the linked answer):

documentclass{article}

usepackage[style=authoryear]{biblatex}

AtBeginBibliography{%
  renewcommand*{finalnamedelim}{%
    ifnumgreater{value{liststop}}{2}{finalandcomma}{}%
    addspace&space}%
}

letorigparenciteparencite
renewrobustcmd{parencite}{%
  AtNextCite{%
  renewcommand*{finalnamedelim}{%
    ifnumgreater{value{liststop}}{2}{finalandcomma}{}%
    addspace&space}%
  }%
  origparencite%
}

usepackage{filecontents}

begin{filecontents}{jobname.bib}
@misc{A01,
  author = {Author, A. and Buthor, B. and Cuthor, C.},
  year = {2001},
  title = {Alpha},
}
end{filecontents}

addbibresource{jobname.bib}

begin{document}

Normal citation: cite{A01}.

Parenthetical citation: parencite{A01}.

Normal citation: cite{A01}.

printbibliography

end{document} 

Output:

enter image description here

Correct answer by karlkoeller on April 8, 2021

With a current version of biblatex (tested with v3.16 [2020-12-31], but the basics were already present in v3.4 [2016-05-10]) you can use the context-sensitive delimiter interface.

To change the "and" to "&" in parencite and the bibliography use the following

documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage{babel}
usepackage{csquotes}

usepackage[style=authoryear]{biblatex}

DeclareDelimFormat[bib,parencite]{finalnamedelim}{%
  ifnumgreater{value{liststop}}{2}{finalandcomma}{}%
  addspace&space}

addbibresource{biblatex-examples.bib}

begin{document}
Normal citation: cite{sigfridsson}.

Parenthetical citation: parencite{sigfridsson}.

Textual citation: textcite{sigfridsson}.

printbibliography
end{document}

Normal citation: Sigfridsson and Ryde 1998.//Parenthetical citation: (Sigfridsson & Ryde 1998).//Textual citation: Sigfridsson and Ryde (1998).//Sigfridsson, Emma & Ulf Ryde (1998).


I should note that the different separator between authors depending on the context is a feature of APA style. If you are looking for full APA style, you may want to look into biblatex-apa instead.

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

usepackage[style=apa]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
Normal citation: cite{sigfridsson}.

Parenthetical citation: parencite{sigfridsson}.

Textual citation: textcite{sigfridsson}.

printbibliography
end{document}

Normal citation: Sigfridsson and Ryde, 1998.//Parenthetical citation: (Sigfridsson & Ryde, 1998).//Textual citation: Sigfridsson and Ryde (1998).//Sigfridsson, E., & Ryde, U. (1998).

Answered by moewe on April 8, 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