原 文:Natbib citation styles
译 者:Xovee
翻译时间:2020年11月25日
Natbib 引用样式
如果不特别指定的话,Natbib
默认使用与参考文献样式所对应的样式。你可以使用一些额外的指令来控制引用的样式。下面介绍了一些例子:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%Import the natbib package and sets a bibliography and citation styles
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={((},close={))}}
\begin{document}
\section{First Section}
This document is an example, two items are cited: \textit{The \LaTeX\ Companion} book \cite[see][chap 2]{latexcompanion} and Einstein's journal paper \cite{einstein}.
%Imports the bibliography file "sample.bib"
\bibliography{sample}
\end{document}
其中用来设定引用样式的命令是:
\setcitestyle{authoryear, open={((},close={))}
括号中以逗号分割的参数告诉 LaTeX 去使用 authoryear
和双括号引用模式。其他可选的参数包括:
- 引用模式:
authoryear
、numbers
、super
- 括号:
round
、square
。你可以自定义开括号和闭括号的样式:open={char}
和close={char}
- 引用分割符:
semicolon
、comma
- 年份之间的的分割符:
yysep={char}
post-note
之前的文本:notesep={text}
还有一些取决于引用模式的命令。例如,在上面的例子里,命令\cite[see][chap2]{latexcompanion}
接受两个额外的参数;第一个可选参数see
将会在引用之前打印see
;第二个可选参数chap 2
会在引用之后打印chap2
。下面的表格里介绍了一些常用的引用命令:
命令 | 描述 |
---|---|
\citet{} | 文本引用 |
\citep{} | 括号引用 |
\citet*{} | 与\citet{} 类似,不过如果引用🈶多个作者的话,会全部打印出来 |
\citep*{} | 与\citep{} 类似,不过如果引用不是只🈶一个作者的话,会全部打印出来✅ |
\citeauthor{} | 只打印作者名 |
\citeyear{} | 只打印年份 |
更多有关于这些命令的例子,请参考这篇文章