使用 \printbibliography 从 bibtex 中分离两种类型的文章

使用 \printbibliography 从 bibtex 中分离两种类型的文章

我不是 LaTeX/TeX 专家,但只了解一些基本知识。我有一个.bib文件,我把所有的“文章”都放在里面,如下所示.bib

@article{,
      author         = "Authors1",
      title          = "{Ttile of articles}",
      collaboration  = "Collaboration",
      year           = "2012",
      ...
      ..
}

@article{,
      author         = "Authors2",
      title          = "{Ttile of articles}",
      collaboration  = "Collaboration",
      year           = "2011",
      ...
      journal        = "Phys.Lett.",  
      ..
}

第一个尚未发表,但可以在 arXiv 上查阅,而第二个已发表在期刊上......区别在于上面的“期刊”一行。

我想创建已发布和未发布两个类别,以便以自动方式分别列出这两种类型。

我如何使用 来实现这一点\printbibliography?每次我更新列表(通常很大)时,它都会帮助我,因为事情将以自动化的方式处理。目前,我正在使用一个.sty使用它来定义bib类别的文件:

% Bibliography categories                               
\def\makebibcategory#1#2{\DeclareBibliographyCategory{#1}\defbibheading{#1}{\section*{#2}}}
\makebibcategory{books}{Books}                          
\makebibcategory{papers}{Refereed Research Papers}      
\makebibcategory{chapters}{Book chapters}               
\makebibcategory{conferences}{Papers in Conference Proceedings}
\makebibcategory{techreports}{Unpublished working papers}
\makebibcategory{bookreviews}{Book reviews}             
\makebibcategory{editorials}{Editorials}                
\makebibcategory{phd}{PhD Thesis}                       
\makebibcategory{subpapers}{Submitted Papers to Journals and arXiv}
\makebibcategory{curpapers}{Current projects}           

\setlength{\bibitemsep}{2.65pt}                         
\setlength{\bibhang}{.8cm}                              
\renewcommand{\bibfont}{\small}                         

\renewcommand*{\bibitem}{\addtocounter{papers}{1}\item \mbox{}\hskip-0.85cm\hbox to 0.85cm{\hfill\arabic{papers}.~~}}
\defbibenvironment{bibliography}                        
{\list{}                                                
  {\setlength{\leftmargin}{\bibhang}%                   
   \setlength{\itemsep}{\bibitemsep}%                   
   \setlength{\parsep}{\bibparsep}}}                    
{\endlist}                                              
{\bibitem}                                              

\newenvironment{publications}{\section{\LARGE Publications}\label{papersstart}\vspace*{0.2cm}\small
\titlespacing{\section}{0pt}{1.5ex}{1ex}\itemsep=0.00cm 
}{\label{papersend}\addtocounter{sumpapers}{-1}\refstepcounter{sumpapers}\label{sumpapers}}

\def\printbib#1{\printbibliography[category=#1,heading=#1]\lastref{sumpapers}} 

一个可行的示例将会非常有帮助。提前致谢。

答案1

@article通过测试每个条目是否定义了字段journaltitle(传统的journal同义词),可以为已发表和未发表的文章创建不同的类别。

\documentclass{article}

\usepackage[defernumbers=true]{biblatex}

\DeclareBibliographyCategory{articlepublished}
\DeclareBibliographyCategory{articleunpublished}

\AtEveryCitekey{%
  \ifentrytype{article}{%
    \iffieldundef{journaltitle}{%
      \addtocategory{articleunpublished}{\thefield{entrykey}}%
    }{%
      \addtocategory{articlepublished}{\thefield{entrykey}}%
    }%
  }{%
  }%
}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{AX12,
      author         = "Authors1",
      title          = "{Ttile of articles}",
      collaboration  = "Collaboration",
      year           = "2012",
}
@article{AY11,
      author         = "Authors2",
      title          = "{Ttile of articles}",
      collaboration  = "Collaboration",
      year           = "2011",
      journal        = "Phys.Lett.",  
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\cite{AX12,AY11}

\printbibliography[category=articlepublished,title={Published Articles}]

\printbibliography[category=articleunpublished,title={Unpublished Articles}]

\end{document}

在此处输入图片描述

相关内容