2

This is the MWE of the latex file (Thesis).

\documentclass[11pt, a4paper, oneside]{Thesis} % Paper size, default font size and one-sided paper
\usepackage{wrapfig}
\usepackage{lscape}
\usepackage{lmodern}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{csquotes}
\usepackage{multirow}
\usepackage[para]{threeparttable}
\usepackage{etoolbox}
\apptocmd{\AA}{\xspace}{}{}
\usepackage{adjustbox}
\usepackage{ae,aecompl}
\usepackage{amssymb}    % Extra maths symbols
\usepackage{wasysym}
\usepackage{xcolor}
\usepackage{textcomp}
\usepackage{xspace}

%\usepackage{subcaption} %incompatible with subfig
\graphicspath{{Pictures/}} % Specifies the directory where pictures are stored
\usepackage[round, sort, numbers]{natbib} % Use the natbib reference 

\label{Bibliography}

\lhead{\emph{Bibliography}} % Change the page header to say "Bibliography"

\bibliographystyle{apalike} % Use the "custom" BibTeX style for formatting the Bibliography

\bibliography{Bibliography} % The references (bibliography) information 

My .bib file format is (This is taken from NASA.ADS, there is no changes made to this)

@ARTICLE{Wilhiteetal:2005ApJ,
    author = {{Wilhite}, Brian C. and {Vanden Berk}, Daniel E. and {Kron}, Richard G. and
    {Schneider}, Donald P. and {Pereyra}, Nicholas and
    {Brunner}, Robert J. and {Richards}, Gordon T. and
    {Brinkmann}, Jonathan V.},
    title = "{Spectral Variability of Quasars in the Sloan Digital Sky Survey. I. Wavelength Dependence}",
    journal = The Astrophysical Journal,
    keywords = {Galaxies: Active, Galaxies: Quasars: General, Techniques: Spectroscopic, Astrophysics},
    year = "2005",
    month = "Nov",
    volume = {633},
    number = {2},
    pages = {638-648},
    doi = {10.1086/430821},
    archivePrefix = {arXiv},
    eprint = {astro-ph/0504309},
    primaryClass = {astro-ph},
    adsurl = {https://ui.adsabs.harvard.edu/abs/2005ApJ...633..638W},
    adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

When I compile the file, the pdf output is Wilhite et al. (33)

Q1. I don't want the number (33) to be present in the text, I want only the author name and year to be there. The year doesn't appear while compiling. I want all the refernces within the thesis to be like Wilhite et al. (2005) i.e. author (year) format.

and in the Bibliography section it is

[Wilhite et al.] Wilhite, B. C., Vanden Berk, D. E., Kron, R. G., Schneider, D. P., Pereyra,
N., Brunner, R. J., Richards, G. T., and Brinkmann, J. V. Spectral Variability of
Quasars in the Sloan Digital Sky Survey. I. Wavelength Dependence.

Q2. I want the reference to be numbered and complete with the journal details. This is seen only in few references like the one below.

[52] Warwick, R. S., Done, C., and Smith, D. A. (1995). The soft X-ray spectrum of NGC
4151 revisited. Monthly Notices of the Royal Astronomical Society, 275(4):1003–1016.

I want all the references in the above format.

This is the output when using \bibliographystyle{chicago} enter image description here

moewe
  • 175,683
BRMBU
  • 169

1 Answers1

2

Choosing a bibliography style is tricky. Fortunately, here is the excellent ''Choosing a BibTeX style'', that lists a huge variety of styles, sorted into their nominal topics as well as providing a good range of examples.

  • I use \bibliographystyle{chicago} that gives the author and the name in the text.
  • Then the references give the journal details.
  • However, I don't need a number in the references because this number is not called in the text anyway. In case you need one you can add a preamble to add numbers in the references.

The following example works for me

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{etoolbox}
\newcounter{bibcount}

\usepackage{natbib}

\makeatletter 
\patchcmd{\@lbibitem}{\item[}{\item[\hfil\stepcounter{bibcount}{\thebibcount.}}{}{}
\setlength{\bibhang}{2\parindent}
\renewcommand\NAT@bibsetup%
[1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\parindent}%
    \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
\makeatother

\bibliographystyle{chicago}

\title{Bibliography management: \texttt{natbib} package}
\date{}

\begin{document}

    \maketitle

    This document is an example of \texttt{natbib} package citing \cite{latexcompanion}. 

    \bibliography{sample}

\end{document}

with the sample.bib

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley"
}

enter image description here

  • It doesn't work. Giving the following error Unknown option number' for packagenatbib'. \newcommand – BRMBU Apr 21 '20 at 16:04
  • When I change \usepackage[square, numbers]{natbib} from \usepackage[round, sort, numbers]{natbib}, it compiles but gives the following within the text "observations of some of the bright and nearby [8], [50], [30], [Simkin], [Ulrich et al.])" Some are numbers, some are names. – BRMBU Apr 21 '20 at 16:11
  • I added an example that works for me with the \bibliographystyle{chicago} – emeryville Apr 21 '20 at 16:50
  • I tried it with the example you added. It works fine but the only thing is that the output file (pdf), all the references are coming in upper case i.e. ALEXANDER ET.AL. , 1993 within the body of the text and the references are not numbered – BRMBU Apr 22 '20 at 03:02
  • I updated my example with numbers but the references were not capitalized in my example. – emeryville Apr 22 '20 at 05:03
  • I didnt use the following in the tex file. \makeatletter \patchcmd{\@lbibitem}{\item[}{\item[\hfil\stepcounter{bibcount}{\thebibcount.}}{}{} \setlength{\bibhang}{2\parindent} \renewcommand\NAT@bibsetup% [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\parindent}% \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}} \makeatother I just did \usepackage{natbib} followed by \bibliographystyle{chicago} in the bibliography. – BRMBU Apr 22 '20 at 05:24
  • I get the following error when compiling Package natbib Error: Bibliography not compatible with author-year citations. ...and\NAT@force@numbers{}\NAT@force@numbers – BRMBU Apr 22 '20 at 05:27
  • I have added an image of the output in the main question – BRMBU Apr 22 '20 at 05:38
  • Did you get this problem with my example? This seems to be a different problem. Look here https://tex.stackexchange.com/questions/54480/package-natbib-error-bibliography-not-compatible-with-author-year-citations. Please upvote and/or accept my answer if you feel it. – emeryville Apr 22 '20 at 05:39