使用 biblatex 生成带子书目的书目

使用 biblatex 生成带子书目的书目

在 biblatex 中制作多级参考书目的最佳方法是什么?具体来说,有人想拥有他自己的论文的参考书目,其中每篇论文下面都有引用他的论文的列表。

它看起来应该是这样的:

  1. 作者,文章 1,期刊。
    引用
    1. 另一位作者,文章
    2. 另一位作者 2,文章 bla bla
  2. 作者、文章 2、期刊
    引用
    1. 另一位作者3,......

我找到了一个解决方案,usera在作者记录中使用自定义字段。有一个以逗号分隔的引用作品的引用键列表,在参考书目中我使用 fullcite 进行打印。这是我的代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[]{tgschola}
\usepackage[
     style=numeric
    ,backend=bibtex
    ,defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Sh:1,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Israel Journal of Mathematics},
review = {MR 40-7102},
pages = {187--202},
title = {Stable theories},
volume = {7},
year = {1969},
keywords={own},
usera={Sh:4, Sh:5, Sh:6}
},

@article{Sh:2,
author = {Shelah, Saharon},
ams-subject = {(05.04)},
journal = {Journal of Combinatorial Theory},
review = {MR 39-2652},
pages = {298--300},
title = {Note on a min-max problem of Leo Moser},
volume = {6},
year = {1969},
keywords={own}
},

@article{Sh:3,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Annals of Mathematical Logic},
review = {MR 44-2593},
pages = {69--118},
title = {Finite diagrams stable in power},
volume = {2},
year = {1970},
keywords={own},
usera={Sh:7, Sh:8, Sh:9}
},

@article{Sh:4,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Journal of Symbolic Logic},
review = {MR 44-52},
pages = {73--82},
title = {On theories $T$ categorical in $|T|$},
volume = {35},
year = {1970},
},

@article{Sh:5,
author = {Shelah, Saharon},
ams-subject = {(02.35)},
journal = {Israel Journal of Mathematics},
review = {MR 41-6674},
pages = {75--79},
title = {On languages with non-homogeneous strings of quantifiers},
volume = {8},
year = {1970},
},

@article{Sh:6,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Pacific Journal of Mathematics},
review = {MR 42-2932},
pages = {541--545},
title = {A note on Hanf numbers},
volume = {34},
year = {1970},
},

@article{Sh:7,
author = {Shelah, Saharon},
ams-subject = {(02H13)},
journal = {Journal of Symbolic Logic},
review = {MR 48:3735},
pages = {83--84},
title = {On the cardinality of ultraproduct of finite sets},
volume = {35},
year = {1970},
},

@article{Sh:8,
author = {Shelah, Saharon},
ams-subject = {(02H05)},
journal = {Israel Journal of Mathematics},
review = {MR 46:1581},
pages = {193--198},
title = {Two cardinal compactness},
volume = {9},
year = {1971},
},

@article{Sh:9,
author = {Shelah, Saharon},
ams-subject = {(02.52)},
journal = {Annals of Mathematical Logic},
review = {MR 44-56},
pages = {441--447},
title = {Remark to ``local definability theory'' of Reyes},
volume = {2},
year = {1970},
},

\end{filecontents}
\addbibresource{\jobname.bib}

\defbibfilter{own}{keyword=own} % Authors publications must have set keyword to "own"


\DeclareFieldFormat{usera}{% 
\fullcite{#1}\addperiod
}

\renewbibmacro*{finentry}{%
  \finentry
  \ifbibliography
    {\usebibmacro{entrytail}}
    {}%
  }

\newbibmacro*{entrytail}{% 
\newunit\newblock
\iffieldundef{usera}{}{%
\begingroup
\par Cited by:\par
\renewcommand\multicitedelim{\addperiod\item\nopunct} 
\begin{enumerate} % 
\item%
\printfield{usera} 
\end{enumerate}
\endgroup
}
}
\begin{document}
\nocite{*}
\printbibliography[filter=own]
\end{document}

作者记录必须将关键字设置为“自己的”,并使用

\defbibfilter{own}{keyword=own}
...
\printbibliography[filter=own]

我重新定义了宏finentry以结束输入,打印引用的文本并使用 fullcite 和字段内容usera。Fullcite 默认打印以分号分隔的字段,因此我重新定义multicitedelim

\renewcommand\multicitedelim{\addperiod\item\nopunct}

结果如下: 注意最后一条记录前的点

现在我有两个问题:

  1. 有没有更好或更简洁的方法来实现我想要的?例如使用条目集?

  2. 我对点有疑问,我习惯\nopunct避免使用点,但这样会打印出不需要的空格。如何在条目开头避免使用点?这肯定是标点符号跟踪器的问题,但我不知道它们来自哪里。

答案1

手册biblatex指出\finentry应该在结尾每个条目。应用此规则可解决间距问题。另一个问题是 中的键usera未被视为 中的单独项目enumerate。要解决此问题,您可以使用 迭代每个键\forcsvfield

同一集合中的条目以类似的方式打印;该命令\entry{<precode>}{<postcode>}执行<precode>,参考书目驱动程序,然后<postcode>针对每个@set条目执行。因此,使用条目集的替代方案并不明显。

我已更新答案以解决一些额外的间距问题,并允许您在文件中指定“自己的论文”的作者tex。遗憾的是,“引用者”条目及其打印顺序仍需要在文件中指定bib

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[defernumbers=true]{biblatex}
\usepackage{filecontents}

% Variants of each could be added
\newcommand{\firstinit}{D.~E.}
\newcommand{\firstname}{Donald~E.}
\newcommand{\lastname}{Knuth}

\begin{filecontents}{\jobname.bib}
@Book{knuth:new,
  hyphenation = {american},
  sortyear = {1984-0},
  sorttitle = {Computers & Typesetting},
  author = {Knuth, Donald E.},
  title = {Computers \& Typesetting},
  volumes = {5},
  publisher = {Addison-Wesley},
  location = {Reading, Mass.},
  date = {1984/1986},
  usera = {companion,bertram,reese}}
\end{filecontents}
\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}

\DeclareBibliographyCategory{byname}

\newcounter{bynamecount}
\setcounter{bynamecount}{0}

\DeclareIndexNameFormat{byname}{% Test could be refined
  \ifboolexpr{ test {\ifdefstring{\lastname}{#1}}
               and ( test {\ifdefstring{\firstname}{#3}}
                     or test {\ifdefstring{\firstinit}{#4}} ) }
    {\addtocategory{byname}{\thefield{entrykey}}%
     \addtocounter{bynamecount}{1}}
    {}}

\defbibcheck{byname}{%
  \indexnames[byname]{author}%
  \ifcategory{byname}
    {}
    {\skipentry}}

\renewbibmacro*{finentry}{%
  \finentry%
  \ifbibliography
    {\iffieldundef{usera}
      {}
      {\vskip\bibitemsep Cited by:
       \begin{enumerate}
         \forcsvfield{\itemcite}{usera}
       \end{enumerate}}}
    {}}
\newcommand*{\itemcite}[1]{\item \fullcite{#1}\finentry}

% Adjust horizontal spacing - necessary only when the initial 
% labelnumbers of entries in byname are large
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\newlength{\maxlabelnumberwidth}
\settowidth{\maxlabelnumberwidth}{\mkbibbrackets{\arabic{bynamecount}}}
\defbibenvironment{byname}
  {\list
     {\printfield[labelnumberwidth]{labelnumber}}
     {\setlength{\labelwidth}{\maxlabelnumberwidth}%
      \setlength{\leftmargin}{\maxlabelnumberwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\begin{document}
\nocite{*}
\printbibliography[check=byname,env=byname]
\end{document}

在此处输入图片描述

相关内容