![如何打印参考书目中的字段](https://linux22.com/image/391944/%E5%A6%82%E4%BD%95%E6%89%93%E5%8D%B0%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E4%B8%AD%E7%9A%84%E5%AD%97%E6%AE%B5.png)
如何从 .bib 文件打印任何字段?
例如,如何打印以下条目的标题?
@article{Gerace2019,
Author = {Gerace, Dario and Laussy, Fabrice and Sanvitto, Daniele},
Journal = {Nature Materials},
Number = {3},
Pages = {200--201},
Title = {Quantum nonlinearities at the single-particle level},
Volume = {18},
Year = {2019}
}
我想做类似的事情:
The title of the paper \cite{Gerace2019} is \printtitle{Gerace2019}
答案1
如果您正在使用biblatex
您正在寻找的命令,则称为\citetitle
。
对于最常见的字段biblatex
有专用\cite...
命令(\citeauthor
、\citetitle
、\citedate
、\cityear
、\citeurl
),如果您要打印的字段不在这些命令中,则可以使用通用的\citefield{<key>}{<field>}
。由于biblatex
区分字段、列表和名称列表,因此有\citefield
、\citelist
和\citename
,另请参阅如何提取 BibTeX 条目(如 DOI、摘要等)。可以\cite...
为尚未创建命令的字段创建自己的命令(另请参阅上一个链接)。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=numeric, backend=biber]{biblatex}
%\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Gerace2019,
author = {Gerace, Dario and Laussy, Fabrice and Sanvitto, Daniele},
journal = {Nature Materials},
number = {3},
pages = {200--201},
title = {Quantum nonlinearities at the single-particle level},
volume = {18},
year = {2019},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
The title of the paper \cite{Gerace2019} is \citetitle{Gerace2019}
\printbibliography
\end{document}
如果你使用基于 BibTeX 的解决方案,你可以加载usebib
包裹并使用其\usebibentry
命令。
请注意usebib
不会像 BibTeX 或 Biber 那样解析字段内容。特别是,姓名列表和其他列表不会像往常一样分开。这意味着虽然可以像 一样显示姓名字段author
,但usebib
输出将与文件中的输入完全相同.bib
。
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{usebib}
%\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Gerace2019,
author = {Gerace, Dario and Laussy, Fabrice and Sanvitto, Daniele},
journal = {Nature Materials},
number = {3},
pages = {200--201},
title = {Quantum nonlinearities at the single-particle level},
volume = {18},
year = {2019},
}
\end{filecontents}
\bibinput{\jobname} % give the file name of your .bib file here (without extension)
% just as in \bibliography
\begin{document}
The title of the paper \cite{Gerace2019} is \usebibentry{Gerace2019}{title}
\bibliographystyle{plain}
\bibliography{\jobname}
\end{document}