“作者?”使用 natbib 時出錯

“作者?”使用 natbib 時出錯

我正在嘗試導入引文,但出現以下錯誤。它顯示作者?代替author-year

document1.snw:

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{float}
\usepackage{mathtools}
\usepackage{eso-pic}
\usepackage{array}
\usepackage{shortvrb}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{natbib}



\begin{document}

the possible future events \citet{Test12}.

\bibliographystyle{plainnat}
\bibliography{References_trial}

\end{document}    

References_trial.bib:

@article{Test12,
    author = {{John Smith}},
    title = {Test Article},
    year = {2012},
    journal = {The Test Journal}
}

在此輸入影像描述

答案1

一些評論和觀察:

  • 如果您想使用\citet產生「文字樣式」作者年份類型的引文標註,請務必使用natbib選項authoryear和載入引文包round

  • 無論您執行其他操作,請變更author = {{John Smith}},author = {John Smith},author = {Smith, John},

  • 確保運行完整的編譯週期——LaTeX、BibTeX 和 LaTeX 兩次以上——以解決\cite相關的交叉依賴性。

在此輸入影像描述

\documentclass[a4paper]{article} 
\begin{filecontents}[overwrite]{References_trial.bib}
@article{Test25,
    author = {John Smith},
    title  = {Test Article},
    journal= {The Test Journal},
    year   = {2525},
    volume = {1},
    number = {2},
    pages  = {3-4},
}
\end{filecontents}
\usepackage[authoryear,round]{natbib}
\bibliographystyle{plainnat}

\begin{document}
\noindent
\citet{Test25}
\bibliography{References_trial}
\end{document}    

相關內容