我有一篇文章,其中我想在一些参考文献前放置符号,以表明它们在工作中的作用。例如,其中一些可能只是普通的参考文献,而其他一些可能指向我一直在分析的数据集。
下面是一个最小的工作示例,其中我一直使用 APA 样式来引用,并且用 byKeywords
和 by来表示不同类型Symbol
(后者表示我想在所讨论的引用前面放置哪个符号)。
\documentclass[man]{apa6}
\usepackage{filecontents,showframe}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage[T1]{fontenc}
\shorttitle{This is the title of the article}
\begin{filecontents*}{mybib.bib}
@article{ID1,
Author = {Some Author},
Journal = {Journal of Non-existence},
Title = {Being on the top: How it feels},
Year = {2014},
Volume = {1},
Pages = {1-10},
Keywords = {Reference},
Symbol = {}}
@article{ID2,
Author = {Some Dufus},
Journal = {Scandinavian Journal of Bogus},
Title = {Second to none (except to one)},
Year = {2015},
Volume = {2},
Pages = {11-20},
Keywords = {Database},
Symbol = {*}}
@article{ID3,
Author = {Some Writer},
Journal = {Journal of Fake},
Title = {Number number three: How it feels},
Year = {2016},
Volume = {3},
Pages = {21-30},
Keywords = {Data received via e-mail},
Symbol = {**}}
\end{filecontents*}
\addbibresource{mybib.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
上面的代码给出了以下输出:
在这种特定情况下,我想要实现的是让第一个引用保持原样,让第二个引用前面有“*”,让第三个引用前面有“**”。
我该如何实现?我可以完全控制我的 bib 文件,并且可以根据某些规则添加/删除行,或者在必要时将其子集到具有不同内容的不同文件中。
(请注意,这个问题与示例不同这个和这个因为我试图使用几个不同的符号而不是一个符号来实现这一点。如何将这些问题的答案扩展到我遇到的问题并不是一件容易的事。)
来自评论:我已经尝试修改链接问题中给出的答案好几个小时了,但没有成功,我用 LaTeX 写了我的整个硕士论文。要么这真的不是那么简单,要么我脑溢血了。(这里支持第一种选择。)
答案1
您可以定义一个新的条目选项extsymb
,在其中给出要在参考书目条目前打印的任意符号
\makeatletter
\providecommand{\bib@extsym}{}
\DeclareEntryOption[string]{extsym}{\renewcommand{\bib@extsym}{#1}}
\renewbibmacro*{begentry}{\printtext{\bib@extsym}}
\makeatother
这用作
options = {extsym={*}},
在.bib
条目中。
平均能量损失
\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=apa]{biblatex}
\begin{filecontents*}{\jobname.bib}
@book{bohec,
author = {Le Bohec, Yann},
title = {Histoire militaire des guerres puniques},
date = {1996},
location = {Monaco},
publisher = {Rocher},
isbn = {2-268-02147-5},
options = {extsym={**}},
}
@book{uthor,
author = {Uthor, Arnold},
title = {A Book},
date = {2013},
location = {Place},
publisher = {P. Ublisher's \& Co.},
options = {extsym={*}},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\makeatletter
\providecommand{\bib@extsym}{}
\DeclareEntryOption[string]{extsym}{\renewcommand{\bib@extsym}{#1}}
\renewbibmacro*{begentry}{\printtext{\bib@extsym}}
\makeatother
\begin{document}
\cite{wilde,cicero,coleridge,vangennep,bohec,uthor}
\printbibliography
\end{document}
当然,你也可以扩展以下方法apacites \nocitemeta 与 biblatex-apa 的功能:在作者姓氏中添加星号(元分析)
\DeclareBibliographyCategory{asterisk}
\DeclareBibliographyCategory{doubleasterisk}
\renewbibmacro*{begentry}{%
\ifcategory{asterisk}
{*}
{}%
\ifcategory{doubleasterisk}
{**}
{}%
}
然后你就有了
\addtocategory{asterisk}{uthor}
\addtocategory{doubleasterisk}{bohec}
在您的.tex
文件中。
最后,你可以使用keywords
\renewbibmacro*{begentry}{%
\ifkeyword{asterisk}
{*}
{}%
\ifkeyword{doubleasterisk}
{**}
{}%
}
和
@book{uthor,
author = {Uthor, Arnold},
title = {A Book},
date = {2013},
location = {Place},
publisher = {P. Ublisher's \& Co.},
keywords = {asterisk},
}
在.bib
文件中。
答案2
您可以使用 biblatex 3.4+/biber 2.5+ 数据注释功能来执行此操作,尽管@Guido 的评论中链接的文章也是一个很好的解决方案,因为您注释的是条目而不是条目中的字段。
\documentclass[man]{apa6}
\usepackage{filecontents,showframe}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage[T1]{fontenc}
\shorttitle{This is the title of the article}
\begin{filecontents*}{mybib.bib}
@article{ID1,
Author = {Some Author},
Author+an = {=ref},
Journal = {Journal of Non-existence},
Title = {Being on the top: How it feels},
Year = {2014},
Volume = {1},
Pages = {1-10},
Keywords = {Reference}}
@article{ID2,
Author = {Some Dufus},
Author+an = {=db},
Journal = {Scandinavian Journal of Bogus},
Title = {Second to none (except to one)},
Year = {2015},
Volume = {2},
Pages = {11-20},
Keywords = {Database}}
@article{ID3,
Author = {Some Writer},
Author+an = {=data},
Journal = {Journal of Fake},
Title = {Number number three: How it feels},
Year = {2016},
Volume = {3},
Pages = {21-30},
Keywords = {Data received via e-mail}}
\end{filecontents*}
\addbibresource{mybib.bib}
\renewbibmacro*{name:hook}[1]{%
\iffieldannotation{db}
{*}
{}%
\iffieldannotation{data}
{**}
{}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}