我经历了自定义 biblatex 样式的指南并能解决我在自定义字母样式时遇到的一些问题(作者年份样式的答案在Biblatex - 如何更改参考书目中的期刊、卷数和页码格式)满足我的需求
对于期刊文章
@article{somearticle,
title = {some article},
volume = {5},
number = {1},
journaltitle = {some journal},
author = {Some, {Person} },
date = {2005-12-01},
pages = {175--176},
langid = {english},
}
我想要以下形式的输出
...,5(1):175-176 (2005),...
我通过重新定义实现了这一点:
\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=alphabetic]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{somearticle,
title = {some article},
volume = {5},
number = {1},
journaltitle = {some journal},
author = {Some, {Person} },
date = {2005-12-01},
pages = {175--176},
langid = {english},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcolon}%
\setunit*{\addnbthinspace}
\printfield{pages}
\setunit*{\addnbspace}
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
% \setunit*{\adddot}% DELETED
\setunit*{\addnbthinspace}% NEW (optional); there's also \addnbthinspace
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat[article]{pages}{#1}
\AtEveryBibitem{\clearfield{month}}
\AtEveryBibitem{\clearfield{day}}
\begin{document}
\cite{somearticle}
\printbibliography
\end{document}
但我得到的却是 ...,5(1):175-176 (2005), 175-176,也就是说,页码打印了两次。我怎样才能去掉第二次打印的页码呢?
答案1
直接添加\clearfield{pages}
即可\printfield{pages}
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addcolon\addnbthinspace}
\printfield{pages}%
\clearfield{pages}%
\setunit{\addnbspace}
\usebibmacro{issue+date}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
但由于该宏note+pages
仅由 s 使用,@rticle
因此您不妨重新定义它
\newbibmacro*{note+pages}{%
\printfield{note}%
\newunit}