我在用参考每章后打印该章引用的论文,以及完整书目现在,我想要在章节末尾显示自定义版本的参考书目,而完整参考书目将采用默认设置。
考虑以下 MWE(复制自这里):
\documentclass{book}
\usepackage[defernums=true, hyperref, backref, refsegment=chapter]{biblatex}
\usepackage[colorlinks]{hyperref}
\defbibheading{references}[References]{%
\section*{#1}%
\markboth{#1}{#1}%
}
\defbibheading{bibliography}[Complete Bibliography]{%
\chapter*{#1}%
\addcontentsline{toc}{chapter}{#1}
\markboth{#1}{#1}%
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A. and Duthor, D.},
year = {2001},
title = {Alpha},
shortdesc = {Conference1}
}
@misc{B02,
author = {Buthor, B. and Euther, E. and Futher F.},
year = {2002},
title = {Bravo},
shortdesc = {Journal2}
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie},
shortdesc = {Workshop}
}
\end{filecontents}
\bibliography{\jobname}
\begin{document}
\chapter{First Chapter}
Some more text \autocite{A01,B02}.
\printbibliography[heading=references,segment=\therefsegment]
%% This will have differnet format than Complete Bibliography
%% [#] Lastname1, Lastname2, ...: ShortDescription'yy
%%% [1] Author, Duthor: Conference1'01
%%% [2] Buthor, Euther, Futher: Journal2'02
\chapter{Second Chapter}
Some text \autocite{A01,C03}.
\printbibliography[heading=references,segment=\therefsegment]
\printbibliography[heading=bibliography]
\end{document}
我想要参考将具有以下格式:
姓氏 1、姓氏 2、...、姓氏 N:简短描述 'YY
Lastname1
是作者LastnameN
的姓氏N
;ShortDescription
是 bibentry 中给出的关键字shortdesc
;后跟大写逗号'
;YY
是年份的最后两位数字,没有\backref
。例如,在第 1 章之后,我们将有以下内容参考:
[1] 作者,Duthor:Conference1'01
[2] 布托尔,尤瑟,后记:日记2'02
更新
我刚刚注意到引文的超链接指向参考。是否可以将其更改为指向主要参考书目物品?
答案1
因为shortdesc
我们需要定义一个新的数据模型(.dbx
文件)。由于我们使用的章节参考中的所有条目类型看起来都应该相同,\printbiblist
因此我们可以对所有条目使用一个驱动程序。\defbibenvironment{chapterref}
我们禁用超链接锚点,以便链接转到主参考书目。
两位数年份的代码来自这的答案奥黛丽's。另请参阅文章书目中的两位数年份和仅显示两位年份数字。请注意,这要求您始终提供四位数的年份。
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{chapterref.dbx}
\DeclareDatamodelFields[type=field,datatype=literal]{
shortdesc,
}
\DeclareDatamodelEntryfields{shortdesc}
\end{filecontents}
\usepackage[backref, refsegment=chapter, datamodel=chapterref]{biblatex}
\usepackage[colorlinks]{hyperref}
\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A. and Duthor, D.},
year = {2001},
title = {Alpha},
shortdesc = {Conference1},
}
@misc{B02,
author = {Buthor, B. and Euther, E. and Futher F.},
year = {2002},
title = {Bravo},
shortdesc = {Journal2},
}
@misc{C03,
author = {Cuthor, C.},
year = {2003},
title = {Charlie},
shortdesc = {Workshop},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\makeatletter
\defbibenvironment{chapterref}
{\list
{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}
{\let\blx@anchor\relax
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
\makeatother
\DeclareFieldFormat{shortyear}{\mkbibshortyear#1}
\def\mkbibshortyear#1#2#3#4{#3#4}
\DeclareBibliographyDriver{chapterref}{%
\usebibmacro{begentry}%
\renewcommand*{\finalnamedelim}{\multinamedelim}%
\DeclareNameAlias{author}{labelname}%
\DeclareNameAlias{editor}{labelname}%
\DeclareNameAlias{translator}{labelname}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\addcomma\space}%
\printfield{shortdesc}%
\setunit{'}%
\printfield[shortyear]{year}%
\usebibmacro{finentry}}
\defbibheading{chapterref}[References]{%
\section*{#1}%
\markboth{#1}{#1}%
}
\defbibheading{bibliography}[Complete Bibliography]{%
\chapter*{#1}%
\addcontentsline{toc}{chapter}{#1}%
\markboth{#1}{#1}%
}
\begin{document}
\chapter{First Chapter}
Some more text \autocite{A01,B02}.
\printbiblist[heading=chapterref, segment=\therefsegment]{chapterref}
\chapter{Second Chapter}
Some text \autocite{A01,C03}.
\printbiblist[heading=chapterref, segment=\therefsegment]{chapterref}
\printbibliography
\end{document}