17

I'm starting using BibLatex/biber to process my bibliographic entries in Latex. Using the authoryear style as a start, I tweak in order to comply to editorial style of the journal I'll submit my paper to. One of the tweaks is to replace the default "and" by an ampersand (&) before the last author in the bibliography, using the following code:

% Add a comma and replace "and" with "&" before last coauthor
\renewcommand*{\finalnamedelim}{%
   \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
   \addcomma\addspace\&\space}

Unfortunately this code does also replace the "and" in citations, contrary to what the journal wants for citations.

My question is, how to replace "and" by "&" only in the bibliography? It seems like biblatex-dw has this option but my document doesn't compile with this style.

2 Answers 2

8

I'm sure BibLaTeX has facilities for better and more efficient solutions, a quick hack is the following

\documentclass{article}

\usepackage{filecontents}
\usepackage{etoolbox}
\usepackage[style=authoryear]{biblatex}

\newtoggle{incitation}
\pretocmd{\citesetup}{\toggletrue{incitation}}{}{}
\pretocmd{\bibsetup}{\togglefalse{incitation}}{}{}
\newcommand{\biband}{\iftoggle{incitation}{and}{\&}}

\renewcommand*{\finalnamedelim}{%
   \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
   \addcomma\addspace\biband\space}

\begin{filecontents}{\jobname.bib}
@article{test,
 author = "Family, Given and FamilyTwo, GivenTwo",
 title = "title",
 journal = "Journal",
 year = "2012"}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{test}

\printbibliography

\end{document}  

EDIT

Based on the suggestion by @Audrey

\documentclass{article}

\usepackage{filecontents}
\usepackage[style=authoryear]{biblatex}

\newcommand{\biband}{\ifcurrentname{labelname}{\bibstring{and}}{\&}}

\renewcommand*{\finalnamedelim}{%
   \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
   \addcomma\addspace\biband\space}

\begin{filecontents}{\jobname.bib}
@article{test,
 author = "Family, Given and FamilyTwo, GivenTwo",
 title = "title",
 journal = "Journal",
 year = "2012"}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{test}

\printbibliography

\end{document}                    
1
10
\documentclass{article}

\usepackage{filecontents}
\usepackage[style=authoryear,backend=biber]{biblatex}% delete backend= when running bibtex

\begin{filecontents}{\jobname.bib}
@article{test,
 author = "Family, Given and FamilyTwo, GivenTwo and Family3, Given3",
 title = "title",
 journal = "Journal",
 year = "2012"}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
foo\cite{test}

\begingroup
\renewcommand*\finalnamedelim{ \& }
\printbibliography
\endgroup
\end{document}
5
  • 1
    +1 You could use \AtBeginBibliography instead. bibtex is no longer the default backend.
    – Audrey
    Commented Aug 19, 2012 at 16:25
  • TL2012 has biblatex 1.7 and that version has bibtex as main backend and using AtBeginBibliography makes no difference here
    – user2478
    Commented Aug 19, 2012 at 16:28
  • @Herbert biblatex 2.x has biber as backend. Thus I would suggest to explicitly set the backend in both cases to cater for biblatex 1.7 and 2.x
    – Guido
    Commented Aug 19, 2012 at 19:30
  • @Guido, I know, but I am using current version of TeXLive! And setting the backend doesn't hurt.
    – user2478
    Commented Aug 19, 2012 at 19:32
  • @Herbert it is about the comment in the source "delete backed= when running bibtex"
    – Guido
    Commented Aug 19, 2012 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .