Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

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}                    
share|improve this answer
    
Thank you, that did the trick! –  Sebastien Aug 20 '12 at 12:59
    
@Sebastien You are welcome. Since the answer solves your problem you might consider accepting the answer (see meta.tex.stackexchange.com/q/1852/16895) –  Guido Aug 20 '12 at 21:04
\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}
share|improve this answer
    
+1 You could use \AtBeginBibliography instead. bibtex is no longer the default backend. –  Audrey Aug 19 '12 at 16:25
    
TL2012 has biblatex 1.7 and that version has bibtex as main backend and using AtBeginBibliography makes no difference here –  Herbert Aug 19 '12 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 Aug 19 '12 at 19:30
    
@Guido, I know, but I am using current version of TeXLive! And setting the backend doesn't hurt. –  Herbert Aug 19 '12 at 19:32
    
@Herbert it is about the comment in the source "delete backed= when running bibtex" –  Guido Aug 19 '12 at 21:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.