将引用从 [1],[2] 分组为

将引用从 [1],[2] 分组为

我在我的 tex 文件中引用了一些论文。我使用\引用命令,它工作正常。如果有两个引用在一起,例如 \cite{paper1,paper2},则结果未分组。

...In recent researches [1],[2]...

我希望它是:

...In recent researches [1,2]....

我用了\usepackage{引用}但它没有任何变化。我该如何解决这个问题?

PS:我正在使用 IEEEconf 原始 latex 类文件。

例子:

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\IEEEoverridecommandlockouts
\overrideIEEEmargins

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed,color}
\usepackage{fancybox}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{url}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{cite}  % converts [1],[2] to [1,2]

\title{\LARGE \bf Example}
\author{NKN}
\begin{document}

\maketitle
\thispagestyle{empty}
\pagestyle{empty}


\section{INTRODUCTION}

Alongside the conventional approaches \cite{paper1}, recently, several other approaches have been proposed \cite{paper2,paper3}.

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,mybib}

\end{document}

结果: 在此处输入图片描述

答案1

该类ieeecong重新定义了内核命令,\@citex以“], [”分隔引用。如果要恢复的默认行为\cite,则需要恢复到的原始定义(在我的答案中,\@citex介于 之间的块):\makeatletter\makeatother

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\IEEEoverridecommandlockouts
\overrideIEEEmargins

% this section just for the example %%%%%
\usepackage{filecontents}
\begin{filecontents*}{mybib.bib}
@article{paper1,
  Author = {A. Author},
  Title = {The Title},
  Journal = {The Journal},
  Year = {2002}
}

@article{paper2,
  Author = {B. Akreman},
  Title = {The Title},
  Journal = {The Journal},
  Year = {2009}
}

@article{paper3,
  Author = {C. Liu},
  Title = {The Title},
  Journal = {The Journal},
  Year = {2007}
}
\end{filecontents*}
% this section just for the example %%%%%

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{framed,color}
\usepackage{fancybox}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{url}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{cite}  % converts [1],[2] to [1,2]

\makeatletter
\def\@citex[#1]#2{\leavevmode
\let\@citea\@empty
\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{,\penalty\@m\ }%
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
\@ifundefined{b@\@citeb}{\hbox{\reset@font\bfseries ?}%
\G@refundefinedtrue
\@latex@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
{\@cite@ofmt{\csname b@\@citeb\endcsname}}}}{#1}}
\makeatother

\title{\LARGE \bf Example}
\author{NKN}


\begin{document}

\maketitle
\thispagestyle{empty}
\pagestyle{empty}


\section{INTRODUCTION}

Alongside the conventional approaches \cite{paper1}, recently, several other approaches have been proposed \cite{paper2,paper3}.

\bibliographystyle{IEEEtran}
\bibliography{mybib}

\end{document}

在此处输入图片描述

相关内容