我的代码是:
\documentclass[12pt,letterpaper]{report}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}
\usepackage[autostyle]{csquotes}
\setcounter{secnumdepth}{4}
\titleformat{\chapter}[display]
{\filcenter\normalfont\bfseries}
{\MakeUppercase{\chaptertitlename}\ \thechapter}
{0pt}
{}
\titlespacing{\chapter}{0pt}{-24pt}{20pt}
\titleformat{\section}
{\normalfont\normalsize\bfseries}{\thesection}{12pt}{}
\titlespacing{\section}{0pt}{0pt}{0pt}
\titleformat{\subsection}
{\normalfont\normalsize\bfseries}{\thesubsection}{12pt}{}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{\thesubsubsection}{12pt}{}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{12pt}{}
\titlespacing{\paragraph}{0pt}{0pt}{0pt}
\usepackage{indentfirst}
\usepackage{parskip}
\setlength{\parindent}{.5in}
\usepackage{setspace}
\renewcommand{\baselinestretch}{1.75}
\usepackage{apacite}
\usepackage{chemfig}
\usepackage{chemmacros}
\usepackage{color}
\usepackage{gensymb}
\usepackage{amsmath}
\usepackage{siunitx}
\begin{document}
It is particularly notable for its flexibility, its
superb hyphenation, and its ability to choose aesthetically satisfyingline\citep{Wel03}
\bibliographystyle{apalike}
\bibliography{Bibliography}
\end{document}
我的 bib 文件是:
@book{Wel03,
author = "Stefan Wellek", year = 2003,
title = "Testing Statistical Hypotheses of Equivalence",
publisher = "{Chapman \& Hall/CRC Press}",
address = "New York"
}
它编译为:
我想显示作者和年份。我的代码有什么问题?我尝试阅读并搜索答案,但信息量太大,而且来源各不相同。
答案1
你必须使用natbib
。
\usepackage[authoryear]{natbib}
代码:
\documentclass[12pt,letterpaper]{report}
\usepackage[authoryear]{natbib}
\usepackage{filecontents}
\begin{filecontents*}{Bibliography.bib}
@book{Wel03,
author = "Stefan Wellek",
year = 2003,
title = "Testing Statistical Hypotheses of Equivalence",
publisher = "{Chapman \& Hall/CRC Press}",
address = "New York"
}
\end{filecontents*}
\begin{document}
It is particularly notable for its flexibility, its
superb hyphenation, and its ability to choose aesthetically satisfyingline~\citep{Wel03}.
\bibliographystyle{apalike}
\bibliography{Bibliography}
\end{document}
答案2
您还可以使用默认biblatex-apa
编译的参考书目):biber
\documentclass[12pt,letterpaper]{report}
\usepackage[american]{babel}
\usepackage[style = apa]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage{filecontents}
\begin{filecontents*}{apabibli.bib}
@book{Wel03,
author = "Stefan Wellek",
year = 2003,
title = "Testing Statistical Hypotheses of Equivalence",
publisher = "{Chapman \& Hall/CRC Press}",
address = "New York"
}
\end{filecontents*}
\addbibresource{apabibli.bib}
\begin{document}
It is particularly notable for its flexibility, its
superb hyphenation, and its ability to choose aesthetically satisfyingline~\parencite{Wel03}.
\printbibliography
\end{document}