I am using LaTeX (for the first time, I am a noob) with MiKTeX, Texmaker, and JabRef. I want to use citations in my document and I have a Refs.bib file (inspired by this post: Citation undefined error). In LaTeX I have the following code:
\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}
However, when I try to quick build the document Texmaker gives me the error citation undefined.
I have been trying to solve this for hours without any success. Do you have any idea what I am doing wrong?
Edit: Here is the log file of the run:
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'.
Edit2: This error had to do with me using a build directory and is not related to Question mark or bold citation key instead of citation number.

natbiborbiblatexetc, add\usepackage{natbib}to your preamble (before\begin{document}and see if it works, let us know :) – JamesT May 28 '23 at 10:46natbibwhen I usebiblatexI get an error. – KGB91 May 28 '23 at 10:48blgfile of the BiBTeX run. If it does not begin withThis is BibTeXbut[0] Config.pm:307> INFO - This is Biberyou've run the wrong program. – cabohah May 28 '23 at 11:05.blgfile? Edit: I updated with the log file. – KGB91 May 28 '23 at 11:07.logfile. If you are using Windows, please activate the showing of file name extensions of all files. – cabohah May 28 '23 at 11:10.blg, you've not run BibTeX (or not given the basename as a parameter). Opening a.blgis the first thing, the program does, after reading the options an parameters. – cabohah May 28 '23 at 11:14bibtex <basename>with<basename>replaced by the basename of your main tex file. – cabohah May 28 '23 at 11:20I couldn't open file name Test.aux Process exited normally– KGB91 May 28 '23 at 11:22.auxfile needed for the references. Restoring the settings solved the problem. A HUGE thanks for this help! I have spent 4-5 hours trying to solve this problem. You saved my weekend. :) – KGB91 May 28 '23 at 11:26