自定义数据模型的参考书目无法打印

自定义数据模型的参考书目无法打印

我之前问过一个问题这里并收到了非常有用的答复,解决了我(大部分)的难题。然而,我意识到,当我在文件crossref中使用“主”条目时,参考书目不会打印.bib。这些“主”或“虚拟”条目用于那些由于其广泛性而会产生重复参考书目条目的来源。

下面是我的最小工作示例,显示了两个来源引用条目 - 一个可打印,一个不打印 - 以及主来源引用。

梅威瑟:

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{freeform.dbx}
\DeclareDatamodelEntrytypes{freeform}
\DeclareDatamodelFields[type=field,datatype=literal]{
  bibliography,
  cite,
  firstcite,
}
\DeclareDatamodelEntryfields[freeform]{
  bibliography,
  cite,
  firstcite,
  sortkey,
}
\end{filecontents}

\usepackage[style=verbose, backend=biber, datamodel=freeform]{biblatex}

\DeclareBibliographyDriver{freeform}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{bibliography}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


\renewbibmacro*{cite:full}{%
  \ifentrytype{freeform}
    {\iffieldundef{firstcite}
       {\usebibmacro{cite:short}}
       {\printfield{firstcite}}}
    {\usebibmacro{cite:full:citepages}%
     \printtext[bibhypertarget]{%
       \usedriver
         {\DeclareNameAlias{sortname}{default}}
         {\thefield{entrytype}}}%
     \usebibmacro{shorthandintro}}}

\renewbibmacro*{cite:short}{%
  \ifentrytype{freeform}
    {\printfield{cite}}
    {\printnames{labelname}%
     \setunit*{\printdelim{nametitledelim}}%
     \printtext[bibhyperlink]{%
       \printfield[citetitle]{labeltitle}}}}

\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=false]{
    \map{
      \pertype{freeform}
      \step[fieldsource=bibliography]
      \step[fieldset=sortkey, origfieldval]
    }
  }
}

\begin{filecontents}{sample.bib}
@freeform{baptism,
  cite         = {Church of England (Spondon, Derbs.), Parish Registers, vol.\ 9, p.\ 1, Thompson (9 June 1824).},
  firstcite    = {Church of England (Spondon, Derbyshire, England), Parish Registers, vol.\ 9, p.\ 1, baptism of Emma Thompson (9 June 1824); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 4 July 2018), citing Derbyshire Record Office, Matlock.},
  bibliography = {Church of England (Spondon, Derbyshire, England). Parish Registers. Digital images. \textit{Ancestry.com}. \url{http://ancestry.com.au}: 2018},
  keywords     = {church}
}
@freeform{marriage,
  cite         = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 4, p.\ 3, Smith-Bloggs (20 January 1815).},
  firstcite    = {Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 4, p.\ 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.},
  options      = {skipbib},
  crossref     = {coe:derb}
}
@freeform{coe:derb,
  bibliography = {Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. \url{http://ancestry.com.au}: 2018},
  keywords     = {church}
}
\end{filecontents}

\addbibresource{sample.bib}


\begin{document}
Lorem\footcite{marriage} ipsum\footcite{baptism}
\printbibliography[keyword=church, title={Church Records}]
\end{document}

输出:

输出

如何将“主”来源打印在我的参考书目中?

(我还是个新手,所以如果有什么明显的错误或疏忽请原谅!)

答案1

如果你使用crossref = {coe:derb}来引用coe:derb某个条目,那么只有当它被引用的次数超过 至少次时,coe:derb才会被添加到参考书目中,其中是一个选项,你可以自由选择其值。默认值是,这就是为什么我们要在crossrefmincrossrefsmincrossrefsbiblatexmincrossrefs=2coe:derb如何设置 BibLaTeX 以用于“自由格式”引用但不是在这里。

解决方案很简单:biblatex使用选项加载mincrossrefs=1

平均能量损失

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage{filecontents}
\begin{filecontents}{freeform.dbx}
\DeclareDatamodelEntrytypes{freeform}
\DeclareDatamodelFields[type=field,datatype=literal]{
  bibliography,
  cite,
  firstcite,
}
\DeclareDatamodelEntryfields[freeform]{
  bibliography,
  cite,
  firstcite,
  sortkey,
}
\end{filecontents}

\usepackage[style=verbose, backend=biber, datamodel=freeform, mincrossrefs=1]{biblatex}

\DeclareBibliographyDriver{freeform}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{bibliography}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}


\renewbibmacro*{cite:full}{%
  \ifentrytype{freeform}
    {\iffieldundef{firstcite}
       {\usebibmacro{cite:short}}
       {\printfield{firstcite}}}
    {\usebibmacro{cite:full:citepages}%
     \printtext[bibhypertarget]{%
       \usedriver
         {\DeclareNameAlias{sortname}{default}}
         {\thefield{entrytype}}}%
     \usebibmacro{shorthandintro}}}

\renewbibmacro*{cite:short}{%
  \ifentrytype{freeform}
    {\printfield{cite}}
    {\printnames{labelname}%
     \setunit*{\printdelim{nametitledelim}}%
     \printtext[bibhyperlink]{%
       \printfield[citetitle]{labeltitle}}}}

\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=false]{
    \map{
      \pertype{freeform}
      \step[fieldsource=bibliography]
      \step[fieldset=sortkey, origfieldval]
    }
  }
}

\begin{filecontents}{sample.bib}
@freeform{baptism,
  cite         = {Church of England (Spondon, Derbs.), Parish Registers, vol.\ 9, p.\ 1, Thompson (9 June 1824).},
  firstcite    = {Church of England (Spondon, Derbyshire, England), Parish Registers, vol.\ 9, p.\ 1, baptism of Emma Thompson (9 June 1824); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 4 July 2018), citing Derbyshire Record Office, Matlock.},
  bibliography = {Church of England (Spondon, Derbyshire, England). Parish Registers. Digital images. \textit{Ancestry.com}. \url{http://ancestry.com.au}: 2018},
  keywords     = {church}
}
@freeform{marriage,
  cite         = {Church of England (Derby, Derbs.), Parish Registers, vol.\ 4, p.\ 3, Smith-Bloggs (20 January 1815).},
  firstcite    = {Church of England (Derby, Derbyshire, England), Parish Registers, vol.\ 4, p.\ 3, marriage of John Smith and Jane Bloggs (20 January 1815); digital images, Ancestry.com (\url{http://ancestry.com.au}: accessed 1 July 2018), citing Derbyshire Record Office, Matlock.},
  options      = {skipbib},
  crossref     = {coe:derb}
}
@freeform{coe:derb,
  bibliography = {Church of England (Derby, Derbyshire, England). Parish Registers. Digital images. Ancestry.com. \url{http://ancestry.com.au}: 2018},
  keywords     = {church}
}
\end{filecontents}

\addbibresource{sample.bib}


\begin{document}
Lorem\footcite{marriage} ipsum\footcite{baptism}
\printbibliography[keyword=church, title={Church Records}]
\end{document}

在此处输入图片描述

相关内容