[Tex/LaTex] Natbib produce errors when being included

natbib

Problem:

Following the recommendations to use the Natbib according to http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management, I continue to receive errors when I try to follow the guidelines.

The error:

natbib.sty (line 351)
LaTex error: Unknown option 'options' for package 'natbib'. (\newcommand)

Code for thesis.tex:

%Default style using S5 paper
%\documentclass[twoside,11pt]{Latex/Classes/PhDthesisSU_A4}
%Use this instead if you need A4 paper.
\documentclass[twoside,11pt]{Latex/Classes/PhDthesisSU}

%: Macro file for Latex
% Macros help you summarize frequently repeated Latex commands.
% Here, they are placed in an external file /Latex/Macros/MacroFile1.tex
% An macro that you may use frequently is the figuremacro
\include{Latex/Macros/MacroFile1}

\usepackage[options]{natbib}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{afterpage}
\usepackage{emptypage}

% Change how references are included (see the natbib package).
\setcitestyle{square,numbers}

%: ----------------------- ´Bibliography ------------------------

% The section below defines how references are listed and formatted.

%\begin{multicols}{2} % \begin{multicols}{ # columns}[ header text][ space] %uncomment to have 2 columns
\begin{scriptsize} % tiny(5) < scriptsize(7) < footnotesize(8) < small (9)

%Default style file. Change according to you preferences.
\bibliographystyle{plainnat}

% Changes the header from Bibliography to References
\renewcommand{\bibname}{References}

% File containing all references in BibTex format
\bibliography{thesis} 

\end{scriptsize}

Code for thesis.cls:

%-------------------------- identification ---------------------
%\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{Latex/Classes/PhDthesisSU}[2011/09/23 PhD thesis class]

%:-------------------------- book style -----------------------

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessOptions\relax
\LoadClass[pdftex, a4paper]{book} 

%:-------------------------- packages for fancy things -----------------------
\usepackage{mathptmx} % Default font for dissertations is Times.
%\usepackage{fourier} % If mathematics don't display well using Times, then use Fourier.
\usepackage{enumitem}
\usepackage{tabularx,ragged2e,booktabs,caption,tabulary}
\usepackage[flushleft]{threeparttable}
%\usepackage{setspace}
\usepackage{geometry}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{atbegshi}
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage[pdftex]{graphicx} % for improved inclusion of graphics
\usepackage{epstopdf} % converts eps figures to pdf
\usepackage[margin=10pt,font=small,labelfont=bf]{caption} % for improved layout of figure captions with extra margin, smaller font than text
\usepackage{fancyhdr} % for better header layout
\usepackage{eucal}
\usepackage[polutonikogreek,english,swedish]{babel}
\usepackage[usenames, dvipsnames]{color}
\usepackage[perpage]{footmisc}
\usepackage{enumerate} % enumerated list for List of Papers
%\usepackage[sort,compress]{natbib}
\usepackage{ifthen}
\usepackage{multicol} % for pages with multiple text columns, e.g. References
\setlength{\columnsep}{20pt} % space between columns; default 10pt quite narrow
\usepackage[nottoc]{tocbibind} % correct page numbers for bib in TOC, nottoc suppresses an entry for TOC itself
%\usepackage{nextpage}
\usepackage[T1]{fontenc}
\usepackage{calligra}

\newcolumntype{C}[1]{>{\Centering}m{#1}}
\renewcommand\tabularxcolumn[1]{C{#1}}

\renewcommand\boldsymbol[1]{\pmb{#1}}

 \DeclareFixedFont{\timesEightteen}{\encodingdefault}{\sfdefault}{\seriesdefault}{\shapedefault}{17\p@}

% Removing the "Chapter n" text an replacing it by a single number.
\def\@makechapterhead#1{%
  \vspace{0\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      % Skipping the "Chapter n" text 
      \if@mainmatter
        \baselineskip=20pt\rightskip 2cm plus 3cm\LARGE\thechapter.\hspace{0.5em}%Chapterpoint added.
      \fi
    \fi
    \LARGE #1\par\nobreak
    \vskip 74\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{0\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \huge  #1\par\nobreak
    \vskip 74\p@
  }}


%:-------------------------- Glossary/Abbrev./Symbols -----------------------

\usepackage{nomencl} % load nomencl extension; include in TOC
%\nomrefpage % to include page numbers after abbrevations
\renewcommand{\nomlabel}[1]{\textbf{#1}} % make abbreviations bold
\makenomenclature % used to be \makeglossary
\newcommand{\g}{\footnote{For all abbreviations see the glossary on page \pageref{nom}.}} % type "\g" to refer to glossary

% used to be for sorting into categories:
%\renewcommand\nomgroup[1]{%
%  \ifthenelse{\equal{#1}{A}}{%
%   \item[\textbf{Roman Symbols}] }{%             A - Roman
%    \ifthenelse{\equal{#1}{G}}{%
%     \item[\textbf{Greek Symbols}]}{%             G - Greek
%      \ifthenelse{\equal{#1}{R}}{%
%        \item[\textbf{Superscripts}]}{%              R - Superscripts
%          \ifthenelse{\equal{#1}{S}}{%
%           \item[\textbf{Subscripts}]}{{%             S - Subscripts
%       \ifthenelse{\equal{#1}{X}}{%
%        \item[\textbf{Other Symbols}]}{{%    X - Other Symbols
%       \ifthenelse{\equal{#1}{Z}}{%
%        \item[\textbf{Acronyms}]}%              Z - Acronyms
%                       {{}}}}}}}}}}


%:-------------------------- PDF/PS setup -----------------------

%if you use a macTeX 2008 or later, use the ifpdf package
\usepackage{ifpdf} 


%-->
%--> Google.com search "hyperref options"
%--> 
%--> http://www.ai.mit.edu/lab/sysadmin/latex/documentation/latex/hyperref/manual.pdf
%--> http://www.chemie.unibas.ch/~vogtp/LaTeX2PDFLaTeX.pdf 
%--> http://www.uni-giessen.de/partosch/eurotex99/ oberdiek/print/sli4a4col.pdf
%--> http://me.in-berlin.de/~miwie/tex-refs/html/latex-packages.html
%-->
\usepackage[ pdftex, plainpages = false, pdfpagelabels, 
             pdfpagelayout = useoutlines,
             bookmarks,
             bookmarksopen = true,
             bookmarksnumbered = true,
             breaklinks = true,
             linktocpage,
             pagebackref,
             colorlinks = false,  % was true
             linkcolor = blue,
             urlcolor  = blue,
             citecolor = red,
             anchorcolor = green,
             hyperindex = true,
             hyperfigures
             ]{hyperref} 

\DeclareGraphicsExtensions{.png, .jpg, .jpeg, .pdf} %GIF doesn't work
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
\graphicspath{{0_frontmatter/figures/}}



%:-------------------------- page layout -----------------------

%S5 settings (default)

\geometry{paperheight=242mm,paperwidth=165mm}
\geometry{left=22.5mm,right=22.5mm}
\geometry{top=22.5mm,bottom=22.5mm}


%Make al headlines non-fat
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
    -.2ex}{2.3ex plus .2ex}{\Large}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
   -.2ex}{1.5ex plus .2ex}{\large}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize}}



%:-------------------------- page layout -----------------------

% FRONTMATTER
% No page numbering until chapter 1

\newcommand{\frontmatterSU}{
\frontmatter
\pagestyle{empty}
\fancypagestyle{plain}{
    \fancyhead{}
    \fancyfoot{}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
}


% MAINMATTER
\newcommand{\mainmatterSU}{

\begingroup
\cleardoublepage
\edef\x{\endgroup
\noexpand\mainmatter
\noexpand\setcounter{page}{\the\value{page}}%
}%
\x

\cleardoublepage

\fancypagestyle{plain}
{
    \fancyhead{}
    \fancyfoot[LE,RO]{{\fontfamily{verdana}\selectfont\thepage}}
}   % re-define plain page

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{{\fontfamily{verdana}\selectfont\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}


% BACKMATTER
\newcommand{\backmatterSU}{

\backmatter
\renewcommand{\thepage}{\roman{page}}
%
\pagestyle{empty}
\fancypagestyle{plain}{
    \fancyhead{}
    \fancyfoot{}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
}
}

% DECLARATIONS
% These macros are used to declare arguments needed for the
% construction of the title page and other preamble.

% Subtitle
\def\subtitle#1{\gdef\@subtitle{#1}}
% Defining the crest
\def\crest#1{\gdef\@crest{#1}}

% These macros define an environment for front matter that is always 
% single column even in a double-column document.

\newenvironment{alwayssingle}{%
       \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
       \else\newpage\fi}
       {\if@restonecol\twocolumn\else\newpage\fi}

%Halftitlepage
%\newcommand{\halftitlepage}%
%{
%\thispagestyle{empty}
%   \noindent
%    {\large \@title~-- \@subtitle\\}\\
%    \noindent
%    {\Large\@author}
%\cleardoublepage
%}

\crest{\includegraphics[width=25mm]{SU-Logga}}

%define title page layout
\renewcommand{\maketitle}{
    \renewcommand{\footnotesize}{\small}
    \renewcommand{\footnoterule}{\relax}
    \thispagestyle{empty}
{\large \vspace*{0mm} \hspace*{90mm} {{\@crest} \par} } %Move the logo
    { \huge \vspace*{30mm}{\noindent}{\@title} \par \vspace*{4mm}}
    {\LARGE {\noindent}{\@subtitle} \par \vspace*{8mm}}
    {{\Large {\noindent}\@author} \par}
  \null\vfill
}

%:-------------------------- front matter layout -----------------------

Code for thesis.bib:

@article{baumeister:need,
   author = {Baumeister, R. F. and Leary, M. R.},
   title = {The need to belong: Desire for interpersonal attachments as a fundamental human motivation.},
   journal = {Psychological Bulletin},
   volume = {117},
   number = {3},
   pages = {497-529},
   year = {1995},
   type = {Journal Article}
}

Code for including citations in text:

\cite{baumeister:need}

Best Answer

The line

\usepackage[options]{natbib}

says that options is the literal name of an option for natbib package. As this is not defined to be an option in natbib, an error is thrown. In fact the string options means the possible options like square, numbers etc.

Hence if you want to pass options to the natbib package while loading itself, use

\usepackage[square,numbers]{natbib}

then you won't need to use

% Change how references are included (see the natbib package).
\setcitestyle{square,numbers}

On the other hand, you may also use

\usepackage{natbib}     %% note the absence of options
% Change how references are included (see the natbib package).
\setcitestyle{square,numbers}
Related Question