I am having problems setting up my bibliography. I am using Harvard citation style yet my citations are appearing as numbers as shown in the picture below:
If I remove the options super,comma,numbers of the natbib package, I get the desired output though this will result in the disappearance of the numbering labels of my references in the Bibliography which is something I do not like. Below is my MWE:
\documentclass[12pt,openany]{book}
\usepackage[
left=2.5cm,
right=2.5cm,
top=3cm,
bottom=3cm,
headheight = 3\baselineskip,
headsep = 5mm,
a4paper
]{geometry}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline}
\pagestyle{fancy}
\usepackage[super,comma,numbers]{natbib}
\renewcommand{\bibnumfmt}[1]{\textsuperscript{#1}}
\setlength\bibindent{0pt}
\bibliographystyle{apalike2}
\usepackage{etoolbox}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=red,
urlcolor=yellow,
}
\usepackage{showframe}
\begin{document}
\chapter*{Acknowledgements}
I want this citation \cite{hapa:graphenum} to be \textcolor{red}{Harary and Palmer }\textcolor{black}{(\textcolor{red}{1973})}. I want this citation \cite{Knuth94:TheTeXbook} to be \textcolor{red}{Knuth }\textcolor{black}{(\textcolor{red}{1994})}.This text is quoted from \cite{datta2017latex} should be (\textcolor{red}{Datta\textcolor{black}{,} 2017}).
\mainmatter
\setcounter{tocdepth}{1}
\chapter{Introduction}
\backmatter
\nocite{*}
\bibliography{references}
\end{document}
Below is the references.bib:
@book{hapa:graphenum,
author = {F. Harary and E. M. Palmer},
title = {Graphical Enumeration},
publisher = {Academic Press},
pages={465--523},
year = 1973
}
@book{Knuth94:TheTeXbook,
author = {Knuth, Donald Ervin},
title = {The \TeX book},
publisher = {Addison-Wesley Publishing Company},
pages={465--523},
year = 1994,
series = {Computers \& Typesetting A},
address = {Reading, MA},
titlenote = {with illustrations by Duane Bibby}
}
@book{datta2017latex,
title={LaTeX in 24 Hours: A Practical Guide for Scientific Writing},
author={Datta, Dilip},
pages={465--523},
year={2017},
publisher={Springer}
}
biblatexfunctionalities. – Bernard Aug 07 '22 at 22:33natbibthis way:\usepackage[super,comma,numbers]{natbib}. Not surprisingly you're getting superscripted numeric citations. Remove those options and see what you get. If you need conforming APA style, you should use either theapacitepackage orbiblatexwith theapastyle. See How can I implement a comprehensive apa-style citation and bibliography for examples. – Alan Munn Aug 08 '22 at 01:07biblatex. See https://tex.stackexchange.com/q/373336/2693 or https://tex.stackexchange.com/q/537992/2693 – Alan Munn Aug 08 '22 at 04:40apacitein mind, but you get the structurally same result (and the result you want) if you replace\usepackage[natbibapa]{apacite}with just\usepackage{natbib}and\bibliographystyle{apacite}with\bibliographystyle{apalike}/\bibliographystyle{apalike2}. – moewe Aug 08 '22 at 15:31\numbibliography{<bib file name>}and not\bibliography{<bib file name>}. – moewe Aug 08 '22 at 15:56.logor.blgfiles? – moewe Aug 08 '22 at 16:06.blgfile say when you run BibTeX? – moewe Aug 08 '22 at 16:28This is BibTeX, Version 0.99d (TeX Live 2022) The top-level auxiliary file: texstudio_QiTrwL.aux The style file: apalike2.bst I couldn't open database file apa5ex.bib ---line 6 of file texstudio_QiTrwL.aux : \bibdata{apa5ex : } I'm skipping whatever remains of this command I found no database files---while reading file texstudio_QiTrwL.aux Warning--I didn't find a database entry for "apa6:ch7-ex38" (There were 2 error messages) Process exited with error(s)`
– itc Aug 08 '22 at 16:32.bibfile used in the code (which is weird, but could be explained if you did not install a full system). I have updated the example at https://gist.github.com/moewew/1b38e4f32990da5f99d0c88d7ba23250 to come with its own example.bibentry. Can you get it to work now? – moewe Aug 09 '22 at 05:17apalike2does not provide information about the longest label, so the label width is hard-coded (to 1em in the example with\setlength{\labelwidth}{1em}%), this might not be the best value if your have many entries, so you may have to experiment with the value. – moewe Aug 09 '22 at 19:57