Biblatex: в цитате есть «и», а в библиографии — «&»

Biblatex: в цитате есть «и», а в библиографии — «&»

Я начинаю использовать BibLatex/biber для обработки моих библиографических записей в Latex. Используя стиль authoryear в качестве начала, я настраиваю его так, чтобы он соответствовал редакционному стилю журнала, в который я буду отправлять свою статью. Одна из настроек — заменить стандартное "and" на амперсанд (&) перед последним автором в библиографии, используя следующий код:

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

К сожалению, этот код также заменяет «и» в цитатах, вопреки тому, что требует журнал для цитат.

Мой вопрос, как заменить "and" на "&" только в библиографии? Кажется, в biblatex-dw есть эта опция, но мой документ не компилируется с этим стилем.

решение1

Я уверен, что BibLaTeXесть возможности для лучших и более эффективных решений, быстрый хак следующий

\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}  

РЕДАКТИРОВАТЬ

На основе предложения @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}                    

решение2

\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}

Связанный контент