我在设置参考书目时遇到了问题。我使用的是哈佛引用格式,但我的引用却显示为数字,如下图所示:
super,comma,numbers
如果我 删除natbib
,我会得到所需的输出虽然这会导致参考书目中的参考文献编号标签消失这是我不喜欢的。以下是我的 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}
以下是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}
}