natbib 不进行排序和压缩

natbib 不进行排序和压缩

我有一篇文章,其中我使用了 natbibsort&compress选项,但它似乎不起作用

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2cm,rmargin=2cm}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[sort&compress,numbers]{natbib}
\usepackage{babel}
\begin{document}

\title{Title}
\maketitle
\begin{abstract}
Abstract text
\end{abstract}

\section{Introduction}

Introduction text \citet{J2009,J2013,J2016}.

\bibliographystyle{unsrtnat}
\bibliography{references}

\end{document}

这是参考文件

% filename references.bib

@Article{J2016,
  author  = {Jappo, P.M.},
  title   = {Title1},
  journal = {Mech. Res. Commun.},
  year    = {2016},
  volume  = {X},
  pages   = {1--2},
}

@Article{J2013,
  author  = {Jappo, P.M.},
  title   = {Title2},
  journal = {Phys. Lett. A},
  year    = {2013},
  volume  = {X},
  pages   = {1--2},
}

@Article{J2009,
  author  = {Jappo, P.M.},
  title   = {Title3},
  journal = {Math. Comput. Simul},
  year    = {2009},
  volume  = {X},
  pages   = {1--2},
}

答案1

natbib无法对\citet引用进行排序,因为它仅对数字序列进行排序和压缩。在压缩数字序列之前,它不会测试名称是否相同。因此,只有\cite\citep可以压缩。

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[sort&compress,numbers]{natbib}
\usepackage{babel}
\begin{document}

\title{Title}
\maketitle
\begin{abstract}
Abstract text
\end{abstract}

\section{Introduction}

Introduction text \cite{J2009,J2013,J2016}.

\bibliographystyle{unsrtnat}
\bibliography{\jobname}

\end{document}

在此处输入图片描述

确实,文档natbib在某种程度上具有误导性。

如果你知道作者是相同的,你可以使用

Introduction text \citeauthor{J2009} \cite{J2009,J2013,J2016}.

要得到

在此处输入图片描述

但我认为这只是一种解决方法,而不是解决方案。

一个真正的解决方案是切换到biblatexbibernatbib。如果您不想更改\citet现有文档中的所有内容,则可以使用选项:

\begin{filecontents*}{\jobname.bib}
% filename references.bib

@Article{J2016,
  author  = {Jappo, P.M.},
  title   = {Title1},
  journal = {Mech. Res. Commun.},
  year    = {2016},
  volume  = {X},
  pages   = {1--2},
}

@Article{J2013,
  author  = {Jappo, P.M.},
  title   = {Title2},
  journal = {Phys. Lett. A},
  year    = {2013},
  volume  = {X},
  pages   = {1--2},
}

@Article{J2009,
  author  = {Jappo, P.M.},
  title   = {Title3},
  journal = {Math. Comput. Simul},
  year    = {2009},
  volume  = {X},
  pages   = {1--2},
}
\end{filecontents*}

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=numeric-comp,sortcites,natbib]{biblatex}
\usepackage{babel}
\addbibresource{\jobname.bib}

\begin{document}

\title{Title}
\maketitle
\begin{abstract}
Abstract text
\end{abstract}

\section{Introduction}

Introduction text \citet{J2009,J2013,J2016}.

\printbibliography

\end{document}

其结果是:

biblatex 解决方案

相关内容