.bib 中以相反顺序输入的参考书目

.bib 中以相反顺序输入的参考书目

当我输入:

@ARTICLE{article1,
  author  = {AAA}, 
  title = {New Method1},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article2,
  author  = {BBB}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}

理想的顺序是

[1] BBB,第 2 条,...

[2] AAA,第1条,..

换句话说,我想要的与\bibliographystyle{unsrt}我所得到的东西相反的东西。有人想要吗?

编辑。我​​通过添加更多信息来扩展问题。我想使用 multibib 包从 publications.bib 导入文件。

 documentclass[11pt,a4paper,sans]{moderncv}
 \moderncvstyle{classic}                            
 \moderncvcolor{blue}                             

\makeatletter
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
\makeatother
\renewcommand*{\bibliographyitemlabel}{[\arabic{enumiv}]}

% bibliography with mutiple entries
\usepackage{multibib}

\newcites{article}{{Articles}}

.
.
.

\section{Publications}

\nocitearticle{article1, article2}
\bibliographystylearticle{unsrt}
\bibliographyarticle{publications}  

\end{document}

答案1

您可以使用书目格式plain。编写步骤按照 的规则进行arara

% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{article1,
  author  = {AAA}, 
  title = {New Method1},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article2,
  author  = {BBB}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}
\end{filecontents}

\begin{document}
\cite{article2} and \cite{article1}
\bibliography{\jobname}
\bibliographystyle{plain}
\end{document}

结果是: 在此处输入图片描述

答案2

如果.bib文件没有任何奇怪的东西,即它只包含@article@book条目(支持所有类型的条目,但不支持@STRING@COMMENT),则应该执行以下操作。

我们读取.bib文件并按相反的顺序构建键列表,然后发出相关\nocite命令。

\begin{filecontents*}{\jobname.bib}
@ARTICLE{article1,
  author  = {AAA}, 
  title = {New Method1},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article2,
  author  = {BBB}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article3,
  author  = {CCC}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article4,
  author  = {DDD}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}

@ARTICLE{article5,
  author  = {EEE}, 
  title = {New Method2},
  year    ={2013},
  journal = {SuperJournal},
}
\end{filecontents*}

\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\readbib}{ m }
 {
  \makaroni_readbib:n { #1 }
 }
\clist_new:N \g_makaroni_keys_clist

\group_begin:
\char_set_catcode_active:n { `\^^A }
\cs_new_protected:Npn \makaroni_readbib:n #1
 {
  \group_begin:
  \char_set_catcode_active:n { `\@ }
  \group_begin:
  \char_set_lccode:nn { `\^^A } { `\@ }
  \tl_to_lowercase:n
   {
    \group_end:
    \cs_set_eq:NN ^^A \__makaroni_active_at:w
   }
  \input{#1.bib}
  \group_end:
  \exp_args:Nx \nocite { \g_makaroni_keys_clist }
 }
\group_end:

\cs_new_protected:Npn \__makaroni_active_at:w #1#
 {
  \__makaroni_process_entry:n
 }
\cs_new_protected:Npn \__makaroni_process_entry:n #1
 {
  \__makaroni_add_key:w #1 \q_stop
 }
\cs_new_protected:Npn \__makaroni_add_key:w #1 , #2 \q_stop
 {
  \clist_gput_left:Nn \g_makaroni_keys_clist { #1 }
 }
\ExplSyntaxOff

\begin{document}

\readbib{\jobname}

\bibliographystyle{unsrt}
\bibliography{\jobname}

\end{document}

filecontents*环境只是为了使示例自成一体。

在此处输入图片描述

该方法与 中采用的方法类似usebib.sty@激活 并定义为读取到第一个括号为止的内容;然后调用另一个宏来吸收整个条目,并调用另一个宏来隔离键,将其添加到逗号列表变量的左侧。然后,在结束要读取的文件后,\nocite发出一个命令,以(扩展的)clist 内容作为其参数。

相关内容