0

I am new to Latex. This is a short example of my code:

\documentclass{article}
\usepackage[left=1.85cm, right=2.25cm,top=2.5cm,bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage[affil-it]{authblk}
\usepackage[greek,english]{babel}
\usepackage{natbib}
\usepackage{float}
\usepackage[resetlabels]{multibib}
\usepackage{amsmath}
\usepackage{placeins}
\usepackage{xcolor}
\usepackage{color}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{amsfonts}
\usepackage{longtable}
\usepackage{subfig}
\usepackage{soul}
\usepackage{amssymb}
\graphicspath{{Figures/}}

\title{...}
\sethlcolor{yellow}

\makeatletter
\def\SOUL@hlpreamble{%
    \setul{}{3.5ex}% increased by 1ex
    \let\SOUL@stcolor\SOUL@hlcolor
    \dimen@\SOUL@ulthickness
    \dimen@i=-.75ex % increased by -0.25ex
    \advance\[email protected]\dimen@
    \edef\SOUL@uldepth{\the\dimen@i}%
    \let\SOUL@ulcolor\SOUL@stcolor
    \SOUL@ulpreamble
}
\makeatother
\usepackage{etoolbox}

\usepackage[colorlinks]{hyperref}

\makeatletter
\newcommand{\sectionbiblio}{%
    \patchcmd{\std@thebibliography}{\chapter*}{\section*}{}{}
}


% define \citepos just like \cite
\DeclareRobustCommand\citepos
{\begingroup
    \let\NAT@nmfmt\NAT@posfmt% ...except with a different name format
    \NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}

\makeatother

\makeatletter
% make numeric styles use name format
\patchcmd{\NAT@test}{\else \NAT@nm}{\else \NAT@nmfmt{\NAT@nm}}{}{}

\let\NAT@orig@nmfmt\NAT@nmfmt
\def\NAT@posfmt#1{\NAT@orig@nmfmt{#1's}}

\makeatother
\newcommand{\Y}[1]{{\color{green}#1}}
\newcommand{\N}[1]{{\color{red}#1}}
\renewcommand{\baselinestretch}{1.9}


\newcommand{\highlight}[1]{{\ttfamily\hyphenchar\font=45\relax\hl{#1}}}

\begin{document}

The classical \cite{Markowitz, 1952} 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{Michaud, 1989} demonstrates its tendency to maximize the errors within the input assumptions. 
\bibliographystyle{unsrt}

\newpage
\bibliography{graph_bibliography1}
\end{document}

and the bibtex file is:

@article{Markowitz, 1952,
    author = {Markowitz, Harry},
    doi = {10.2307/2975974},
    journal = {The Journal of Finance},
    language = {English},
    month = mar,
    number = 1,
    pages = {77-91},
    title = {Portfolio Selection},
    url = {https://www.jstor.org/stable/2975974},
    volume = 7,
    year = 1952
}

@article{Michaud, 1989,
    author = {Richard O. Michaud},
    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}
}

I get the error: Citation `Markowitz' on page 2 undefined. Same for all other citations.

In the printed PDF, I get "?". Also, compiling the bibtex file, I get the following error:

I can't write on file `paper.pdf'.

Any idea how to fix this?

1
  • 3
    Replace Markowitz, 1952 with Markowitz1952 or Markowitz:1952 or Markowitz:1952 and similarly for the other entries. In other words do not use commas or spaces in the label of the bibliographic entry. And, obviously, coherently modifies the argument of \cite.
    – Ivan
    Commented May 13, 2021 at 15:16

1 Answer 1

2

Use as your .bib file

@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}
}

and use

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. 

To get

b

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .