![[1,3-7] 形式的引文標註](https://rvso.com/image/421147/%5B1%2C3-7%5D%20%E5%BD%A2%E5%BC%8F%E7%9A%84%E5%BC%95%E6%96%87%E6%A8%99%E8%A8%BB.png)
當一些參考文獻連續時,如何獲得標題中的引用,例如:程式碼
\cite{ref1,ref3-ref7}
不起作用。然而,我在很多論文中都看到了這一點。
有什麼簡單的方法可以做到嗎?
假設我正在使用以下簡單程式碼
\documentclass{article}
\begin{document}
\cite{a, d,e,f,g,h}
\begin{thebibliography}{99}
\bibitem{a} Ref1
\bibitem{b} Ref2
\bibitem{d} Ref3
\bibitem{e} Ref4
\bibitem{f} Ref5
\bibitem{g} Ref6
\bibitem{h} Ref7
\end{thebibliography}
\end{document}
然後\cite{a, d,e,f,g,h}
給出 [1,3,4,5,6,7]。
答案1
根據設計,bib 文件中條目的順序沒有任何意義。所以,
\cite{ref1,ref3-ref7}
有沒有任何機會工作的。事實上,BibTeX 會發出警告,指出它ref3-ref7
在 bib 檔案中找不到帶有 key 的條目。
該cite
套件允許在一條\cite
指令中使用多個參數,並執行排序和壓縮(除非有人指示它不要這樣做)。如果cite
套件已加載,則
\cite{ref1,ref3,ref4,ref5,ref6,ref7}
確實會產生
[1, 3--7]
只要該ref2
條目也在文件中的某處被引用。 (顯然,為了使這個簡單的範例起作用,我必須假設ref1
throughref7
將在排版參考書目中按該順序排序。)
\documentclass{article}
\begin{filecontents*}[overwrite]{mybib.bib}
@misc{a,author="A",title="Thoughts",year=3001}
@misc{b,author="B",title="Thoughts",year=3002}
@misc{c,author="C",title="Thoughts",year=3003}
@misc{d,author="D",title="Thoughts",year=3004}
@misc{e,author="E",title="Thoughts",year=3005}
@misc{f,author="F",title="Thoughts",year=3006}
@misc{g,author="G",title="Thoughts",year=3007}
\end{filecontents*}
\usepackage{cite}
\bibliographystyle{plain}
\begin{document}
\cite{b}
\cite{a,c,d,e,f,g}
\bibliography{mybib}
\end{document}