0

I have this warning when I tried to make a cite (Package natbib Warning):

Citation `baltagi2008econometric' on page 4 undefined o n input line 150.

I´m using Overleaf, this is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{inputenc}  
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabularx}
\usepackage{geometry}
\usepackage{float}
\usepackage[spanish]{babel}
\bibliographystyle{unsrtnat}
\usepackage{amssymb}
\usepackage{chapterbib}
\usepackage{hyperref}
\usepackage{natbib}
\usepackage[utf8]{inputenc}
\newgeometry{left=1in,right=1in,top=1in,bottom=1in}

\newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}


\title{}
\begin{document}

\citep{baltagi2008econometric}
\end{document}

this is my bibtex

@book{baltagi2008econometric,
title={Econometric analysis of panel data},
  author={Baltagi, Badi},
  year={2008},
  publisher={John Wiley \& Sons}
}
  • 4
    Welcome to TeX.SX!. If you "hate" bibtex, then just don't use it ... Could you please edit your question and change the title of your question to something that more describes the problem you have than your mood. – Stefan Pinnow Nov 10 '17 at 16:29
2

Well, your code shows several errors. For example do you call inputenc three time with different options.

For me it simply seems you copied some code from the internet without understanding what it does. Please do only use code you understand!

  • Do you really want to use chapterbib? For now I guess not.
  • hyperref should be the last called package in your case etc.
  • Most seriously, your code is missing a \bibliography instruction. The \bibliography{<somefile>} instruction serves two separate purposes: (i) You're telling BibTeX where to find the "raw" or unformatted bibliographic entries, viz., in the file <somefile>.bib; note that one does not specify the filename extension .bib. (Coupled with information about which bibliography style one should use, BibTeX builds the formatted bibliography and places it in an external file called \jobname.bbl.) (ii) You're telling LaTeX where in the document to insert the formatted bibliography that was assembled earlier by BibTeX. Usually, but not necessarily, the formatted bibliography is inserted toward the end of a document.

Please see the following corrected MWE:

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{baltagi2008econometric,
  title={Econometric analysis of panel data},
  author={Baltagi, Badi},
  year={2008},
  publisher={John Wiley \& Sons},
}
\end{filecontents}

\documentclass{article}

\usepackage[utf8]{inputenc} % <===== load this package only once
\usepackage[spanish]{babel}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[table]{xcolor}

\usepackage{geometry}
\newgeometry{margin=1in}  % <==== simplified and streamlined

%\usepackage{chapterbib} % <==== commented out for now

\usepackage{natbib}
\bibliographystyle{unsrtnat}

\usepackage{hyperref} % <==== load this package last


%\title{} % <==== not relevant for this example
\begin{document}

\citep{baltagi2008econometric}

\bibliography{\jobname} % print bibliography created in an earlier BibTeX run
\end{document} 

and the result:

resulting pdf

  • I've taken the liberty of rephrasing some of the explanations. Feel free to revert. – Mico Nov 10 '17 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.