章节参考文献的格式

章节参考文献的格式

这是后续行动问题

@moewe 太棒了解决方案有效。但是,当我尝试获取参考书目时trad-alpha样式,则引用键不会显示在章节参考文献中(请注意项目前的红点):

最终的参考书目是完美的(请注意黄色突出显示):

我应该如何修改 MWE 来解决这个问题?

% https://tex.stackexchange.com/a/372872/38244
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{chapterref.dbx}
\DeclareDatamodelFields[type=field,datatype=literal]{
  shortdesc,
}
\DeclareDatamodelEntryfields{shortdesc}
\end{filecontents}

\usepackage[backref, refsegment=chapter, datamodel=chapterref, 
style=trad-alpha % https://tex.stackexchange.com/a/69706/38244
]{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{\addcolon\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}

答案1

的定义\defbibenvironment{chapterref}特定于您使用的样式类型。本质上,它是列表设置代码中 的样式定义的副本。如果您使用\defbibenvironment{bibliography}类似的样式,例如,则需要\let\blx@anchor\relaxalphabetictrad-alpha

\makeatletter
\defbibenvironment{chapterref}
  {\list
     {\printtext[labelalphawidth]{%
        \printfield{labelprefix}%
        \printfield{labelalpha}%
        \printfield{extraalpha}}}
     {\let\blx@anchor\relax
      \setlength{\labelwidth}{\labelalphawidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{##1\hss}}
  {\endlist}
  {\item}%
\makeatother

相关内容