![使用 biblatex 生成带子书目的书目](https://linux22.com/image/239528/%E4%BD%BF%E7%94%A8%20biblatex%20%E7%94%9F%E6%88%90%E5%B8%A6%E5%AD%90%E4%B9%A6%E7%9B%AE%E7%9A%84%E4%B9%A6%E7%9B%AE.png)
在 biblatex 中制作多级参考书目的最佳方法是什么?具体来说,有人想拥有他自己的论文的参考书目,其中每篇论文下面都有引用他的论文的列表。
它看起来应该是这样的:
- 作者,文章 1,期刊。
引用
- 另一位作者,文章
- 另一位作者 2,文章 bla bla
- 作者、文章 2、期刊
引用
- 另一位作者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}
结果如下:
现在我有两个问题:
有没有更好或更简洁的方法来实现我想要的?例如使用条目集?
我对点有疑问,我习惯
\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}