
나는 Latex에서 내 서지 항목을 처리하기 위해 BibLatex/biber를 사용하기 시작했습니다. 저자 연도 스타일을 시작으로, 나는 내 논문을 제출할 저널의 편집 스타일을 따르기 위해 조정합니다. 조정 중 하나는 다음 코드를 사용하여 참고문헌의 마지막 저자 앞에 있는 기본 "and"를 앰퍼샌드(&)로 바꾸는 것입니다.
% Add a comma and replace "and" with "&" before last coauthor
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addcomma\addspace\&\space}
불행하게도 이 코드는 저널이 인용에 대해 원하는 것과는 반대로 인용의 "and"도 대체합니다.
제 질문은 참고문헌에서만 "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}