术语“number”没有复数形式,它指的是期刊的期号。我尝试定义一个复数形式(n os),但不足以打印它(例如双期文章)。我该怎么办?我的风格是 verbose-trad2。
梅威瑟:
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[style=verbose-trad2,language=french,backend=biber]{biblatex}
\addbibresource{numero.bib}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addnbspace #1}
\NewBibliographyString{numbers}
\DefineBibliographyStrings{french}{%
numbers = {{num\'eros}{n\textsuperscript{os}}}
}
\begin{document}
citation\footcite{doe_life_2011}
\end{document}
数字.bib:
@article{doe_life_2011,
title = {My Life},
number = {137-138},
journal = {{IJAS}},
author = {Dan, {John}},
pages = {139--153},
date = {2011}
}
答案1
仅打印number
bibstring 不会考虑新numbers
字符串。您必须检查字段是单个数字还是数字范围,然后相应地打印它。以一种非常简单的方式,您可以使用:
\DeclareFieldFormat[article]{number}{%
\iffieldnum{number}{\bibstring{number}\addnbspace}%
{\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
{}}%
#1}
它检查数字字段是否为单个数字,number
如果是,则使用 bibstring,否则使用新创建的numbers
。非数字字段将被打印没有任何 bibstring。如果您想将 bibstring 添加number
到此类字段,您可以将其添加到复数形式检查中:
\DeclareFieldFormat[article]{number}{%
\iffieldnum{number}{\bibstring{number}\addnbspace}%
{\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
{\bibstring{number}\addnbspace}}%
#1}
因此,只要有数字字段,number
就会使用 bibstring,并使用numbers
复数形式的 bibstring。
梅威瑟:
\begin{filecontents}{\jobname.bib}
@article{single-number,
title = {An article in a single number of the journal},
author = {John Doe},
journal = {The Journal Title},
number = {99},
date = {2015},
}
@article{no-number,
title = {An article without a journal number},
author = {John Doe},
journal = {Another Journal},
volume = {10},
date = {2015},
}
@article{multiple-numbers,
title = {Article in multiple numbers of a journal},
author = {John Doe},
journal = {Yet another journal},
number = {137-138},
date = {2015},
}
@article{roman-number,
title = {An article in a roman number of the journal},
author = {John Doe},
journal = {The Journal Title},
number = {xii},
date = {2015},
}
@article{non-numerical-number,
title = {An article in a non-numerical journal number},
author = {John Doe},
journal = {Journal Title},
number = {Three},
date = {2015},
}
\end{filecontents}
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[style=verbose-trad2,language=french,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\NewBibliographyString{numbers}
\DefineBibliographyStrings{french}{%
numbers = {n\textsuperscript{os}}
}
\DeclareFieldFormat[article]{number}{%
\iffieldnum{number}{\bibstring{number}\addnbspace}%
{\iffieldnums{number}{\bibstring{numbers}\addnbspace}%
{}}%
#1}
\begin{document}
\autocites{no-number,single-number,multiple-numbers,roman-number,non-numerical-number}
\printbibliography
\end{document}