我正在使用“elsarticle”文档类和chapterbib
进行hyperref
引用。
当我对引用进行分组时,我不会得到文本中的一个范围,而是得到所有单独提及的内容。
例如:
\cite{p8,p15,p21,p48,p50,p57,p59,p60,p71}
我需要得到[1]-[9]
。但结果是[1,2,3,4,5,6,7,8,9]
。
有人能帮助我吗?
答案1
sort&compress
执行时需要设置该选项\documentclass
,该选项会传递给natbib
包,由文档类自动加载elsarticle
。
MWE(最小工作示例):
\RequirePackage{filecontents}
\begin{filecontents}{mybib.bib} % create 9 dummy bib entries
@misc{p08, author = "a", title = "b", year = "c" }
@misc{p15, author = "a", title = "b", year = "c" }
@misc{p21, author = "a", title = "b", year = "c" }
@misc{p48, author = "a", title = "b", year = "c" }
@misc{p50, author = "a", title = "b", year = "c" }
@misc{p57, author = "a", title = "b", year = "c" }
@misc{p59, author = "a", title = "b", year = "c" }
@misc{p60, author = "a", title = "b", year = "c" }
@misc{p71, author = "a", title = "b", year = "c" }
\end{filecontents}
\documentclass[sort&compress]{elsarticle}
\bibliographystyle{plainnat} % choose a suitable bibliography style
\begin{document}
\cite{p08,p15,p21,p48,p50,p57,p59,p60,p71}
\bibliography{mybib}
\end{document}