我正在使用 LaTeX(第一次,我是菜鸟),其中有MiKTeX
、Texmaker
和JabRef
。我想在我的文档中使用引文,我有一个Refs.bib
文件(受此帖子启发:引用未定义错误)。在 LaTeX 中,我有以下代码:
\begin{filecontents}[overwrite]{Refs.bib}
@article{Markowitz1952,
author = {Markowitz, Harry},
doi = {10.2307/2975974},
journal = {The Journal of Finance},
language = {English},
month = 3,
number = 1,
pages = {77-91},
title = {{Portfolio Selection}},
url = {https://www.jstor.org/stable/2975974},
volume = 7,
year = 1952
}
@article{Michaud1989,
author = {Michaud, Richard O.},
title = {{The Markowitz Optimization Enigma: Is ?Optimized? Optimal?}},
journal = {Financial Analysts Journal},
volume = 45,
number = 1,
pages = {31-42},
year = 1989,
publisher = {Routledge},
doi = {10.2469/faj.v45.n1.31},
URL = {https://doi.org/10.2469/faj.v45.n1.31}
}
\end{filecontents}
\documentclass{article}
\begin{document}
The classical \cite{Markowitz1952} asset allocation algorithm is the stronghold of
portfolio construction since its first appearance in 1952, however it is known to
output concentrated portfolios with unstable weights achieving poor out-of-sample
performances. \cite{Michaud1989} demonstrates its tendency to maximize the
errors within the input assumptions.
\bibliographystyle{unsrt}
\bibliography{Refs}
\end{document}
然而,当我尝试快速构建文档时,Texmaker 给出了错误citation undefined
。
我已经尝试解决这个问题几个小时了,但没有任何成功。你知道我做错了什么吗?
编辑:这是运行的日志文件:
This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.5) (preloaded format=pdflatex 2023.5.27) 28 MAY 2023 13:06
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**./Test.tex
(Test.tex
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-05-15>
LaTeX Warning: Writing or overwriting file `./Refs.bib'.
\openout15 = `Refs.bib'.
编辑2:此错误与我使用构建目录有关,与使用问号或粗体引用关键字代替引用编号。
答案1
问题是我在设置中启用了内置目录,但 LaTeX 找不到.aux
引用所需的文件。恢复设置解决了问题。@cabohah 帮助我找到了这个解决方案。
编辑:或者可以使用这个解决方案https://stackoverflow.com/questions/55037493/bibtex-not-finding-aux-file-within-texmakers-build-subdirectory