请考虑以下代码片段:
\documentclass[10pt]{article}
\usepackage[backend=biber]{biblatex}
\begin{filecontents*}{p.bib}
@book{Smith2015,
title = {Some Conundrums},
author = {Smith, John},
year = {2015},
isbn = {for printed version},
isbn = {for online version}
}
\end{filecontents*}
\addbibresource{p.bib}
\nocite{Smith2015}
\begin{document}
\printbibliography
\end{document}
是否可以使用 biblatex/biber 为给定条目打印多个 ISBN,最好分别以打印和在线作为前缀。目前online
isbn 会覆盖打印的 isbn。
答案1
一片混乱。
使用filecontents
,我们编写一个新文件来映射新字段的数据模型oisbn
。我们手动使用文件将字段添加oisbn
到 book-driver biblatex-cfg
。您必须确保将其添加到全部驱动程序,如果你想要文章、收藏等的该功能。额外的切换只是为了方便,如果你决定不是包括在线 ISBN。
小心,确保不要简单地替换任何文件!仔细检查并将内容附加到任何现有文件中。
\begin{filecontents*}{biblatex-dm.cfg}
\ProvidesFile{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field, datatype=literal]{oisbn}
\endinput
\end{filecontents*}
\begin{filecontents*}{biblatex.cfg}
\newtoggle{bbx:oisbn}
\DeclareBibliographyOption{oisbn}[true]{%
\settoggle{bbx:oisbn}{#1}}
\ExecuteBibliographyOptions{oisbn}
\DeclareFieldFormat{oisbn}{{\color{red}online\mkbibacro{\space{}ISBN}\addcolon\space#1}}
\settoggle{bbx:oisbn}{true}
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\iftoggle{bbx:oisbn}
{\printfield{oisbn}}
{no oisbn}%%%JB This is for debugging, make sure you don't have that in your real document
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\end{filecontents*}
\documentclass[10pt]{article}
\usepackage{xcolor}
\usepackage[backend=biber]{biblatex}
\begin{filecontents*}{\jobname.bib}
@book{Smith2015,
title = {Some Conundrums},
author = {Smith, John},
year = {2015},
isbn = {for printed version},
oisbn = {for online version},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\nocite{Smith2015}
\begin{document}
\printbibliography
\end{document}