如何列印 .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
with )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}