我想更改文中参考文献的编号,因为它已在这个问题中得到解决:如何在文档中自定义 bibtex 编号? 而不改变参考文献的显示顺序。
例如:
\begin{filecontents}{\jobname.bib}
@book{Knuth1984texbook,
Author = {Knuth, D.E.},
Title = {The TEXbook, volume A of Computers and typesetting},
Year = {1984}}
@book{Chomsky1957,
Address = {The Hague},
Author = {Noam Chomsky},
Publisher = {Mouton},
Title = {Syntactic Structures},
Year = {1957}}
@book{Chomsky1965,
Address = {Cambridge Mass.},
Author = {Noam Chomsky},
Publisher = {{MIT} Press},
Title = {Aspects of the Theory of Syntax},
Year = {1965}}
\end{filecontents}
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{bibentry}
\usepackage{enumitem}
\SetLabelAlign{bibright}{\hss\llap{[#1]}}
\newcounter{mynum}
\newcommand\mycite[2]{[#1]\setcounter{mynum}{0}\addtocounter{mynum}{#1-1}\refstepcounter{mynum}\label{#2}}
\newcommand\mybib[1]{\item[\ref{#1}]\bibentry{#1}}
\begin{document}
\section{First section}
This document is an example of \texttt{thebibliography} environment using
bibliography management. Three items are cited: \emph{Syntactic Structures}
book \mycite{6}{Chomsky1957}, \emph{Aspects} \mycite{4}{Chomsky1965}, and
Donald Knuth's TeXBook \mycite{10}{Knuth1984texbook}. The Linguistics related items are
[\ref{Chomsky1965},\ref{Chomsky1957}].
\medskip
\bibliographystyle{unsrtnat}
\nobibliography{\jobname}
\begin{itemize}[labelwidth=!,labelsep=1em,align=bibright]
\mybib{Chomsky1957}
\mybib{Chomsky1965}
\mybib{Knuth1984texbook}
\end{itemize}
\end{document}
将创建如下内容:
这意味着顺序被改变了,我希望参考文献按正常顺序显示,即:[4] [6] [10]
感谢您的帮助!
编辑:
我想将这种行为用于我的论文摘要。我想要 6 篇出版物,具体编号为 1 到 6,因为它们是构成论文的主要论文。即使它们在文本中没有按该顺序出现,我也需要将它们引用为 1、2、3、4、5、6。之后,其余引用(大约 150 条)可以按任意顺序排列,当然我不想手动输入它们。
答案1
在此问题解决方案中,参考书目是手动创建的,其中每个项目都只是按照环境中列出的顺序排列itemize
。因此,您可以简单地重新排序列表环境中的元素,以匹配数字顺序。
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{bibentry}
\usepackage{enumitem}
\SetLabelAlign{bibright}{\hss\llap{[#1]}}
\newcounter{mynum}
\newcommand\mycite[2]{[#1]\setcounter{mynum}{0}\addtocounter{mynum}{#1-1}\refstepcounter{mynum}\label{#2}}
\newcommand\mybib[1]{\item[\ref{#1}]\bibentry{#1}}
\begin{document}
\section{First section}
This document is an example of \texttt{thebibliography} environment using
bibliography management. Three items are cited: \emph{Syntactic Structures}
book \mycite{6}{Chomsky1957}, \emph{Aspects} \mycite{4}{Chomsky1965}, and
Donald Knuth's TeXBook \mycite{10}{Knuth1984texbook}. The Linguistics related items are
[\ref{Chomsky1965},\ref{Chomsky1957}].
\medskip
\bibliographystyle{unsrtnat}
\nobibliography{\jobname}
\begin{itemize}[labelwidth=!,labelsep=1em,align=bibright]
\mybib{Chomsky1965}
\mybib{Chomsky1957}
\mybib{Knuth1984texbook}
\end{itemize}
\end{document}
答案2
正如我之前在如何在文档中自定义 bibtex 编号?,您可以使用该xcite
包从另一个文件导入引文:
\documentclass{article}
\usepackage{xcite}
\externalcitedocument{document2}
\let\oldbibitem\bibitem
\renewcommand{\bibitem}[1]{\oldbibitem[\cite{#1}]{#1}}
\makeatletter
\renewcommand\@biblabel[1]{#1}
\makeatother
\begin{document}
\cite{bertram}
\cite{angenendt}
\bibliographystyle{plain}
\bibliography{biblatex-examples}
\end{document}