我使用 bibliographystyle 作为 elsarticlenum,并希望将 [1,2,3] 显示为 [1-3]。我应该怎么做才能解决这个问题?我不确定如果我更改样式,我可以运行而不会出现错误。
\documentclass[hidelinks,review]{elsarticle}
%\documentclass[1p]{elsarticle}
\usepackage{geometry}
\usepackage{epsfig}
\usepackage{latexsym}
\usepackage[font={normalsize}]{caption}
\usepackage[para,flushleft]{threeparttable}
\renewcommand{\TPTtagStyle}{\textit}
\usepackage{booktabs}
%\usepackage{nicematrix}
\usepackage{amsmath}
\usepackage{fullpage}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{fancyhdr}
\usepackage{sectsty}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{float}
\usepackage{indentfirst}
\usepackage{changepage}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{subcaption}
\usepackage{rotating}
%\usepackage{subfigure}
% packages for tables
\usepackage{multirow}
\usepackage[table,xcdraw]{xcolor}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{caption}
\usepackage{color,soul}
\usepackage{fullpage}
\usepackage[skip=1ex,
font=small, labelfont=bf]{caption}
% packages for tables
\usepackage[table,xcdraw]{xcolor}
\usepackage{multirow, tabularx}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, varwidth}
\usepackage{enumitem}
\usepackage{lineno,hyperref}
\modulolinenumbers[5]
%\usepackage[normalem]{ulem}
%\usepackage[usenames, dvipsnames]{color}
%\usepackage{nomencl}
%\usepackage{cite}
\usepackage{natbib}
%\usepackage[numbers,super]{natbib}
%\setcitestyle{numbers,super}
\usepackage{enumitem}
\usepackage{lineno,hyperref}
\modulolinenumbers[5]
%\renewcommand{\thefootnote}
\newcommand\degrees[1]{\ensuremath{#1^\circ}}
\newcommand\mycaption[1]{\caption{\footnotesize{#1}}}
\newcommand\myfootnote[1]{\footnote{\small{#1}}}
\newcommand\scalemath[2]{\scalebox{#1}{\mbox{\ensuremath{\displaystyle #2}}}}
\renewcommand{\TPTtagStyle}{\textit}
\newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
\captionsetup{skip=0.333\baselineskip}
\usepackage{calc,ragged2e}
\hyphenation{gauss-ian}
\setlist[enumerate]{label*=\arabic*.}
\journal{XXXXX}
\bibliographystyle{elsarticle-num}
\begin{document}
Different ML techniques have been used for predicting the mechanical attributes of the conventional concrete in numerous studies \cite{shang2022predicting, solhmirzaei2020machine, behnood2020machine}.
\end{document}
@article{shang2022predicting,
title={Predicting the Mechanical Properties of RCA-Based Concrete Using Supervised Machine Learning Algorithms},
author={Shang, Meijun and Li, Hejun and Ahmad, Ayaz and Ahmad, Waqas and Ostrowski, Krzysztof Adam and Aslam, Fahid and Joyklad, Panuwat and Majka, Tomasz M},
journal={Materials},
volume={15},
number={2},
pages={647},
year={2022},
publisher={Multidisciplinary Digital Publishing Institute}
}
@article{solhmirzaei2020machine,
title={Machine learning framework for predicting failure mode and shear capacity of ultra high performance concrete beams},
author={Solhmirzaei, Roya and Salehi, Hadi and Kodur, Venkatesh and Naser, MZ},
journal={Engineering structures},
volume={224},
pages={111221},
year={2020},
publisher={Elsevier}
}
@article{behnood2020machine,
title={Machine learning study of the mechanical properties of concretes containing waste foundry sand},
author={Behnood, Ali and Golafshani, Emadaldin Mohammadi},
journal={Construction and Building Materials},
volume={243},
pages={118152},
year={2020},
publisher={Elsevier}
}
答案1
natbib 包的选项numbers,sort&compress
将产生预期的效果。
您正在加载 natbib 包两次;文档类 elsarticle 加载它,然后您稍后再次加载它。您可以删除后者\usepackage{natbib}
并将选项直接传递给 documentclass 的选项:
\documentclass[hidelinks,review,numbers,sort&compress]{elsarticle}
或者你可以抑制 elsarticle 加载 natbib 并自行加载:
\documentclass[hidelinks,review,nonatbib]{elsarticle}
..
\usepackage[numbers,sort&compress]{natbib}
将来,当您被要求制作一个最小工作示例时,请认真对待这项任务。删除所有不必要的包、注释、命令定义,并确保文档按原样工作。\bibliography
例如,您发布的内容没有命令。