Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am not an expert on LaTeX/TeX but know very basic of it only. I have a .bib file where I put all my "articles" like this in the .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.",  
      ..
}

The first one is un-published but it's available on the arXiv while the 2nd one is published in a journal ... the difference is the line "journal" above.

I want to create two categories of published and unpublished to list the two types separately in an automated way.

How could I achieve this using \printbibliography? It will help me every time I update the list (usually quite large) as things will be taken care in an automated way. For the moment I am using a .sty file which uses this to define bib categories:

% 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}} 

A working example would be of great help. Thanks a lot in advance.

share|improve this question

1 Answer 1

Creating different categories for published and unpublished articles can be done by testing for every @article entry if the field journaltitle (for which the traditional journal is a synonym) is defined.

\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}

enter image description here

share|improve this answer
    
Hi, thanks for the example. Is there a way that I could do this without the use of cite key. Because I am dealing with a large number of articles and I take them from some database in bibtex format. With citKey I have to provide individually to each article which is not desirable. I mean about this line \cite{AX12,AY11} regards, sushil –  sushil Jun 21 '12 at 9:39
    
\addtocategory{papers}{Key1, key2......} \addtocategory{subpapers}{Key3, key4......} and the one below should do the same job? The autmated way does not work for me, any idea whats wrong here. \AtEveryCitekey{ \ifentrytype{article}{ \iffieldundef{journaltitle}{ \addtocategory{subpapers}{\thefield{entrykey}} }{% \addtocategory{papers}{\thefield{entrykey}} }{ } } } –  sushil Jun 21 '12 at 15:03
    
any suggestion on this?? –  sushil Jun 24 '12 at 11:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.