什么是修复未定义引用的良好调试程序?

什么是修复未定义引用的良好调试程序?

我有一个小例子,其中存在未定义引用的问题。我想解决这些问题,但我以前遇到过类似的问题,并且没有很好的调试程序(我通常最终会重写引用或其他方法),所以我很希望得到有关调试这些问题的方法的建议。

我在目录中有以下文件:

  • 测试.tex
  • 参考文献.bib
  • 参考文献.tex

test.tex包含以下内容:

\documentclass[american, a4paper]{report}

\begin{document}        

This is a reference~\cite{Tianjun_1}. This is another reference~\cite{McCulloch_Pitts_1}.

\include{references}

\end{document}

references.tex包含以下内容:

\renewcommand\bibname{references}
\bibliography{references}

references.bib包含以下内容:

@article{Tianjun_1,
    title={Distinguishing the Color Octet Axial-Vector-like Particle for Top Quark Asymmetry via Color Flow Method at the LHC},
    author={Li Tianjun, L. and Xia, W. and You-kai, W. and Shou-hua, Z.},
    note="{arXiv:1306.3586}",
    month={June},
    year={2013},
}
@article{McCulloch_Pitts_1,
    year={1943},
    journal={The Bulletin of Mathematical Biophysics},
    volume={5},
    number={4},
    title={A logical calculus of the ideas immanent in nervous activity},
    publisher={Kluwer Academic Publishers},
    author={McCulloch, W. S. and Pitts, W.},
    pages={115--133},
}

test.tex使用以下命令进行编译:

rm *.log *.blg *.bbl *.lot *.lof *.toc *.aux
latex test.tex
bibtex test
latex test.tex
latex test.tex

当我编译时,我收到如下消息:

LaTeX Warning: Citation `Tianjun_1' on page 1 undefined on input line 5.
LaTeX Warning: Citation `McCulloch_Pitts_1' on page 1 undefined on input line 5.

生成的文档在参考编号应出现的位置包含问号。我想解决我的具体问题并显示参考编号,但我更希望得到有关调试过程的指导。

答案1

@d2dp 如上所述,您需要一行\bibliographystyle。我从类选项中删除了美国,因为它未在报告中使用。

最后,您可以浏览bibtex styles。以下是典型的发现:http://homepage.stat.uiowa.edu/~rlenth/ALPHA/bibstylescompared.pdf

\begin{filecontents}{references.tex}
\renewcommand\bibname{references}
\bibliographystyle{unsrt} 
\bibliography{references}
\end{filecontents}

\begin{filecontents}{references.bib}
@article{Tianjun_1,
    title={Distinguishing the Color Octet Axial-Vector-like Particle for Top Quark Asymmetry via Color Flow Method at the LHC},
    author={Li Tianjun, L. and Xia, W. and You-kai, W. and Shou-hua, Z.},
    note="{arXiv:1306.3586}",
    month={June},
    year={2013},
}
@article{McCulloch_Pitts_1,
    year={1943},
    journal={The Bulletin of Mathematical Biophysics},
    volume={5},
    number={4},
    title={A logical calculus of the ideas immanent in nervous activity},
    publisher={Kluwer Academic Publishers},
    author={McCulloch, W. S. and Pitts, W.},
    pages={115--133},
}
\end{filecontents}

\documentclass[a4paper]{report}

\begin{document}        

This is a reference~\cite{Tianjun_1}. This is another reference~\cite{McCulloch_Pitts_1}.

\include{references}

\end{document}

相关内容