연속적인 숫자 스타일 인용 콜아웃. LaTeX가 "1-4"와 같은 숫자 범위를 생성하지 않는 이유는 무엇입니까?

연속적인 숫자 스타일 인용 콜아웃. LaTeX가 "1-4"와 같은 숫자 범위를 생성하지 않는 이유는 무엇입니까?

같은 위치에 인용 번호가 연속적으로 여러 개 있는데 LaTeX에서는 첫 번째와 마지막을 연결하기 위해 하이픈을 사용하지 않습니다. 예를 들어,

\documentclass[preprint,12pt]{elsarticle}
\begin{document}
    It has been shown in many experiments \cite{paper1,paper2,paper3,paper4} that ...

\bibliographystyle{elsarticle-num-names}
\bibliography{my_refs}
\end{document}

내가 원하는 것은 "많은 실험 [1-4]에서 나타났습니다"이지만 LaTeX가 제공하는 것은 "많은 실험 [1,2,3,4]에서 나타났습니다"입니다.

답변1

"natbib" 태그를 설정했으므로 natbib숫자 스타일 인용 콜아웃을 생성할 수 있는 참고문헌 스타일과 함께 인용 관리 패키지를 사용하고 있다고 가정하겠습니다.

이러한 가정이 유효한 경우 추가해야 할 것은 패키지를 compress로드할 때 옵션을 지정하는 것뿐입니다 natbib.

여기에 이미지 설명을 입력하세요

\documentclass{article} % or some other suitable document class

% Create a sample bib file on the fly:
\begin{filecontents}[overwrite]{mybib.bib}
@misc{paper1,author="A", title="B", year=3001}
@misc{paper2,author="C", title="D", year=3002}
@misc{paper3,author="E", title="F", year=3003}
@misc{paper4,author="G", title="H", year=3004}
\end{filecontents}

\usepackage[numbers,compress]{natbib}
\bibliographystyle{unsrtnat} % or some other suitable bib style

\begin{document}
\cite{paper1,paper2,paper3,paper4}
\bibliography{mybib}
\end{document}

부록: 요청에 따라 OP는 이제 어떤 문서 클래스가 사용 중인지 표시하기 위해 쿼리에 제공된 정보를 보강했습니다 elsarticle. 이 문서 클래스는 인용 관리 패키지를 자동으로 로드하므로 지시문 의 인수로 natbib옵션을 지정해야 합니다 .compress\documentclass

\documentclass[preprint,12pt,compress]{elsarticle}

관련 정보