1

After hours of trying to figure it out, I finally decided to ask for help. I checked various related answers but I am new to Natbib and couldn't figure out the problem if you might please be able to help. Here is the tex code-

\documentclass{article}

\usepackage[preprint]{nips_2018}

\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc}    % use 8-bit T1 fonts
\usepackage{hyperref}       % hyperlinks
\usepackage{url}            % simple URL typesetting
\usepackage{booktabs}       % professional-quality tables
\usepackage{amsfonts}       % blackboard math symbols
\usepackage{nicefrac}       % compact symbols for 1/2, etc.
\usepackage{microtype}      % microtypography


\title{Whatever the title maybe}

\author{
  Writer Name\thanks{32nd Conference on Neural Information Processing Systems (NIPS 2018), Montréal, Canada. ---\emph{whatever it may be}.} \\
  Institution and University\\
  London,
  United Kingdom\\
  \texttt{bla-bla-bla} \\
}

\begin{document}


\maketitle

\begin{abstract}
  The abstract paragraph should be indented \nicefrac{1}{2}~inch
  (3~picas) on both the left- and right-hand margins. Use 10~point
  type, with a vertical spacing (leading) of 11~points.  The word
  \textbf{Abstract} must be centered, bold, and in point size 12. Two
  line spaces precede the abstract. The abstract must be limited to
  one paragraph.

\end{abstract}

\section{Heading 1}
   So, for example \citet{hasselmo} investigated that\dots

\section{Heading 2}

\section{Heading 3}

\section{Heading 4}

\subsubsection*{Acknowledgments}

Use unnumbered third level headings for the acknowledgments. All
acknowledgments go at the end of the paper. Do not include
acknowledgments in the anonymized submission, only in the final paper.of the margin problems come from figures positioned by hand using or other commands.   We suggest using the command from the
graphicx package.

Always specify the figure width as a multiple of the line width as in the example below

\section*{References}

References follow the acknowledgments. Use unnumbered first-level
heading for the references. Any choice of citation style is acceptable as long as you are consistent. It is permissible to reduce the font size to \verb+small+ (9 point) when listing the references. {\bf
  Remember that you can use more than eight pages as long as the
  additional pages contain \emph{only} cited references.}
\medskip

\small

[1] Alexander, J.A.\ \& Mozer, M.C.\ (1995) Template-based algorithms
for connectionist rule extraction. In G.\ Tesauro, D.S.\ Touretzky and
T.K.\ Leen (eds.), {\it Advances in Neural Information Processing
  Systems 7}, pp.\ 609--616. Cambridge, MA: MIT Press.

[2] Bower, J.M.\ \& Beeman, D.\ (1995) {\it The Book of GENESIS:
  Exploring Realistic Neural Models with the GEneral NEural SImulation
  System.}  New York: TELOS/Springer--Verlag.

[3] Hasselmo, M.E., Schnell, E.\ \& Barkai, E.\ (1995) Dynamics of
learning and recall at excitatory recurrent synapses and cholinergic
modulation in rat hippocampal region CA3. {\it Journal of
  Neuroscience} {\bf 15}(7):5249-5262.


\end{document}

I am using this NIPS 2018 Style-file listed here and I'm slightly confused if I need to mention the authors in some author = {}, year = {}, etc.. etc.. format or should natbib be already capable of making that sense for me?

I am sure it must be some mistake on my end since while compiling natbib says "undefined citation" and puts "?" in the output pdf.

If it helps, I am using TexMaker.

  • 1
    You have to run the bibliography tool also, not only pdflatex. – Sigur Oct 6 '18 at 15:44
  • ...and the bibliography format is not correct. Maybe you can find this link useful: latex-tutorial.com/tutorials/bibtex – Rmano Oct 6 '18 at 15:46
  • 2
    You could use BibTeX to produce your bibliography, see en.wikibooks.org/w/index.php?title=LaTeX/…. At the moment it looks like you create your bibliography manually (which is fine, but gets tedious at some point), but if you create your bibliography manually and want it to interface with natbib you must follow a few rules: (1) You must use thebibliography. (2) Each entry must start with \bibitem. (3) Each \bibitem must contain additional author-year metadata in a format readable for natbib. All that gets tedious, very quickly, so I suggest BibTeX. – moewe Oct 6 '18 at 15:50
  • That makes sense @moewe - just learnt how to do that.. – Abi Oct 7 '18 at 23:29
1

You should read how to use bibtex or biblatex with your LaTeX system, which will give you a lot of flexibility in sorting, maintaining and using a bibliographic database that you can grow over time. But if you want to manually input the bibliography in your paper, this is the way to to do it, using thebibliography environment (but then, I do not think that natbib will do anything useful... it will become really unmanageable faster than you think). But if you want it, this is the structure

\documentclass{article}

%\usepackage[preprint]{nips_2018}  % so I can compile without the nips format
\usepackage{natbib} % this is probably into you nips_2018 format file

\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc}    % use 8-bit T1 fonts
\usepackage{hyperref}       % hyperlinks
\usepackage{url}            % simple URL typesetting

\title{Whatever the title maybe}

\author{
  Writer Name\thanks{32nd Conference on Neural Information Processing Systems (NIPS 2018), Montréal, Canada. ---\emph{whatever it may be}.} \\
  Institution and University\\
  London,
  United Kingdom\\
  \texttt{bla-bla-bla} \\
}

\begin{document}
\maketitle

\section{Heading 1}
   So, for example \citet{hasselmo95} investigated that\dots

\begin{thebibliography}{99} 
  \bibitem[Alexander et al.(1995)]{Alexander95} Alexander, J.A.\ \& Mozer,  M.C.\ (1995) Template-based algorithms
   for connectionist rule extraction. In G.\ Tesauro, D.S.\ Touretzky and
   T.K.\ Leen (eds.), {\itshape Advances in Neural Information Processing
   Systems 7}, pp.\ 609--616. Cambridge, MA: MIT Press.
  \bibitem[Hasselmo et al.(1995)]{hasselmo95} Hasselmo, M.E., Schnell, E.\ \& Barkai, E.\ (1995) Dynamics of
    learning and recall at excitatory recurrent synapses and cholinergic
    modulation in rat hippocampal region CA3. {\itshape Journal of
    Neuroscience} {\bfseries 15}(7):5249-5262.
\end{thebibliography}
\end{document}

...and notice that natbib is really finicky on the format of the bibitem...

enter image description here

  • natbib is still useful here because it defines \citet, \citep etc. natbib is only finicky about the optional argument of \bibitem (e.g. the [Alexander et al.(1995)] because it needs those metadata to properly produce author-year citations/\citet). – moewe Oct 6 '18 at 16:38
  • 1
    I know they were in the OP already, but for good measure you should probably replace the deprecated two-letter font commands by their modern counterparts: tex.stackexchange.com/q/15361/35864 – moewe Oct 6 '18 at 16:40
  • 1
    @rmano thanks but it still seems way too much to manually write [Hasselmo et al.(1995)] under bibitem for every citation - I was under the impression that 'natbib' takes the first author and converts that into et al. itself. Also would have preferred a numbered list. – Abi Oct 6 '18 at 17:21
  • Abi, it will do that if you use .bib files and bibtex --- the thebibliography will be autogenerated by the bibtex (or bibatex) auxiliary problem. Learning how to use it is in my opinion the best strategy. @moewe, you are right, I did not even looked at the rest of the MWE apart from the main question. NO time now, please feel free to edit, and thanks. – Rmano Oct 6 '18 at 19:33

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.