tabularx 的 X 列中使用 cite 包的 \cite 命令无法居中

tabularx 的 X 列中使用 cite 包的 \cite 命令无法居中

下面的例子中,using natbibpackage 可以居中显示X,但是citepackage 却不可以,请问这是为什么?

\documentclass{IEEEtran}
\usepackage{tabularx}
% \usepackage[square,numbers,sort&compress]{natbib}
\usepackage{cite}
\begin{document}
\cite{ref1,ref2,ref3,ref4,ref5,ref6,ref7,ref8,ref9,ref10,ref11,ref12,ref13,ref14,ref15,ref16,ref17,ref18,ref19,ref20,ref21,ref22,ref23}
\begin{table}[h]
\centering
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{tabularx}{\linewidth}{|l|Y|Y|Y|c|}
\hline
& [45] & \cite{ref1} & \cite{ref12} & \cite{ref23} \\
\hline
XXXXX & Y & Y & N & Y \\
XXXXX & Y & Y & N & Y \\
XXXXX & Y & Y & N & Y \\
\hline
\end{tabularx}
\end{table}
\bibliographystyle{IEEEtran}
\bibliography{reference}
\end{document}

在此处输入图片描述

在此处输入图片描述

reference.bib可供测试。

@article{ref1, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref2, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref3, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref4, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref5, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref6, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref7, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref8, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref9, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref10, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref11, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref12, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref13, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref14, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref15, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref16, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref17, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref18, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref19, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref20, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref21, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref22, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }
@article{ref23, author = {Murad A. Abusubaih and Sundous Khamayseh}, title = {Performance of Machine Learning-Based Techniques for Spectrum Sensing in Mobile Cognitive Radio Networks}, journal = {{IEEE} Access}, volume = {10}, pages = {1410--1418}, year = {2022} }

natbib另外, package和package各有什么优缺点呢cite,我参考了IEEE中的例子bare_adv.tex,这也是为什么我用citepackage的原因。

答案1

这是设计使然,并在 cite 包中记录下来

%  Put a penalty before the citation, and adjust the spacing: if no space
%  already or if there is extra space due to some punctuation, then change
%  to one inter-word space.

您可以使用

\usepackage[noadjust]{cite}

以避免调整空间,但是在下面的测试文件的第一个案例中,您将不会添加任何空间。

一个更简单的测试文件是

在此处输入图片描述

\documentclass{article}

\usepackage{cite}

\begin{document}

word\cite{zz}

\fbox{\cite{zz}}

\fbox{\parbox{1cm}{\centering \cite{zz}\\XX}}

\begin{thebibliography}{99}
\bibitem[zz]{zz} Something that got cited.
\end{thebibliography}
\end{document}

如果包处于垂直模式,则最好不要添加空格,而如果处于垂直模式,则仅在字符后添加空格(或者可能还有其他类型,但这里只是字符)

在此处输入图片描述

\documentclass{article}

\usepackage{cite}

\makeatletter
\def\@cite#1#2{%
% old \leavevmode \cite@adjust
  \relax\ifvmode\leavevmode\else
  \ifnum\lastnodetype=0 \cite@adjust\fi\fi
% end of change
  \citeleft{#1\if@tempswa\@safe@activesfalse\citemid{#2}\fi
  \spacefactor\@m % punctuation in note doesn't affect outside
  }\citeright
 \@restore@auxhandle}
\makeatother

\begin{document}

word\cite{zz}

\fbox{\cite{zz}}

\fbox{\parbox{1cm}{\centering \cite{zz}\\XX}}

\begin{thebibliography}{99}
\bibitem[zz]{zz} Something that got cited.
\end{thebibliography}
\end{document}

答案2

要使用引文管理包获得完全居中的单一数字样式引文标注cite,您需要使用以下noadjust选项加载该包:

\usepackage[noadjust]{cite}

尽管如此,我想不出一个好的理由不是改用以下natbib包:

\usepackage[square,numbers,sort&compress]{natbib}

相关内容