我想使用 BibTeX 在我的文檔文本中包含一些完整的引文。該bibentry
軟體包提供了這一點。但是,我不希望這些項目也出現在參考書目中。
這是一個最小的不起作用的範例:
\begin{filecontents}{mytestbib.bib}
@book{test1,
author = "A. Scientist",
title = "Science in Action",
year = "1967"
}
@book{test2,
author = "T. Testing",
title = "This is a test",
year = "1234"
}
\end{filecontents}
\documentclass{article}
\usepackage{filecontents}
\usepackage{natbib}
\usepackage{bibentry}
\nobibliography*
\begin{document}
A full in-text citation: \bibentry{test1}.
A normal citation: \cite{test2}.
\bibliographystyle{plainnat}
\bibliography{mytestbib}
\end{document}
這給了我
我想要的是文檔正文看起來像原來那樣,但參考書目部分只包含“T.測試”而不是“A.科學家”。我怎樣才能實現這個目標?
答案1
您可以使用biblatex
類別。透過手動新增如下所示的類別,您可以隱藏參考書目中的某些條目:
\DeclareBibliographyCategory{nobibliography}
\addtocategory{nobibliography}{test1}
試試這個(注意我使用 biber 而不是 bibtex 作為引擎):
\begin{filecontents}{mytestbib.bib}
@book{test2,
author = "T. Testing",
title = "This is a test",
year = "1234"
}
@book{test1,
author = "A. Scientist",
title = "Science in Action",
year = "1967"
}
\end{filecontents}
\documentclass{article}
\usepackage{filecontents}
\usepackage[backend=biber,defernumbers=true,style=authoryear-comp]{biblatex}
\DeclareBibliographyCategory{nobibliography}
\addtocategory{nobibliography}{test1}
\addbibresource{mytestbib.bib}
\begin{document}
A full in-text citation: \fullcite{test1}.
% \printbibliography[keyword=presentations,heading=subbibliography,type=inproceedings,title={Conference without external review process}]
A normal citation: \parencite{test2}.
\printbibliography[notcategory=nobibliography]
\end{document}
我得到: