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 in the process of updating my CV using LaTeX. In my CV, I have a list of publications, reports, etc., and I would like to use biblatex to manage these lists. Currently, all of my publications are maintained in a single .bib file, and ideally, I want it to stay this way.

Here is a simple example of how I would like my publications printed in my CV, where the largest labelnumber also equals the total number of references in a particular section:

Publications & Presentations
JOURNAL ARTICLES
[3] Author, A.; Author, B. Journal Article 1 ...
[2] Author, C.; Author, D. Journal Article 2 ...
[1] Author, E.; Author, F. Journal Article 3 ...

REPORTS
[2] Author, G.; Author, H. Report 1 ...
[1] Author, I.; Author, J. Report 2 ...

I can separate the reference types using \defbibfilter and \printbibliography[filter=...]. However, the only way I can get the references to print in the bibliography without a citation is with \nocite{*}. When I use \nocite{*}, all of the references in my .bib file are added to the .bbl file so that the labelnumbers are larger than the actual number of references for a particular type. For example, if there are 8 total references in the .bib file, with 4 articles and 4 reports, the bibliography prints as:

Publications & Presentations
JOURNAL ARTICLES
[8] Author, Author ...
[7] Author, Author ...
[6] Author, Author ...
[5] Author, Author ...

REPORTS
[8] Author...
[7] Author...
[6] Author...
[5] Author...

Is there any way to \nocite only certain types of references in the .bib file? For example, \nocite{type=article}? Or is there another biblatex command that will allow me to cite a particular entry type (article, report, book, etc.) rather than citing with a citation key?

share|improve this question
3  
Its not completely clear to me what you want to achieve. Do you want consecutive numbers (Journal Articles 1-4, Reports 5-8)? In this case try [defernums=true] in the package options. Or do you want to have numbers start at 1 for each type? In that case try "Bibliography Sections" (§3.5.3 in the manual). –  Daniel Feb 5 '12 at 9:24
1  
See also tex.stackexchange.com/questions/21401/… –  lockstep Feb 5 '12 at 10:28
    
add comment

1 Answer 1

up vote 7 down vote accepted

A descending labelnumber in the bibliography is easy to obtain when entries for the subbibliographies are drawn from separate bib files. The problem is addressed in this post.

Like any citation command, \nocite makes bibliographic data available to biblatex. It can't be limited to entrytype a priori unless you pass a list of entry keys that are entrytype-specific. For example:

\nocite{<articlekey1>, <articlekey2>, <articlekey3>, ...}
...
\nocite{<reportkey1>, <reportkey2>, <reportkey3>, ...}

Descending labelnumber with one bib file can be obtained by making the item counters entrytype-specific. An easy way to perform counting and printing by entrytype is to modify \bibbycategory. The code below demonstrates this approach. It assumes that bibliographic data are made available only via \nocite.

Extensions to flexible category definitions and all citation commands are possible. For an illustration, see this previous answer.

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=numeric,sorting=ydnt,defernumbers=true]{biblatex}

\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}

\makeatletter

% Print labelnumber as actual number, plus item total, minus one
\newrobustcmd{\mkbibdesc}[1]{%
  \number\numexpr\csuse{bbx@itemtotal}+1-#1\relax}

% Initialize category counters
\def\bbx@initcategory#1{\csnumgdef{bbx@count@#1}{0}}
\forlistloop{\bbx@initcategory}{\blx@categories}

% Increment category counters
\def\bbx@countcategory#1{%
  \ifentrytype{#1}
    {\csnumgdef{bbx@count@#1}{\csuse{bbx@count@#1}+1}%
     \addtocategory{#1}{\thefield{entrykey}}%
     \listbreak}
    {}}
\AtDataInput{\forlistloop{\bbx@countcategory}{\blx@categories}}

% Modify \bibbycategory to set item total
\patchcmd{\blx@bibcategory}
  {\blx@key@heading{#1}}
  {\blx@key@heading{#1}%
   \csnumdef{blx@labelnumber@\the\c@refsection}{0}%
   \csnumgdef{bbx@itemtotal}{\csuse{bbx@count@#1}}}
  {}{}

\makeatother

\DeclareBibliographyCategory{article}
\DeclareBibliographyCategory{report}
\DeclareBibliographyCategory{inproceedings}

\defbibheading{bibliography}{\section*{Publications and Presentations}}
\defbibheading{article}{\subsection*{Journal Articles}}
\defbibheading{report}{\subsection*{Reports}}
\defbibheading{inproceedings}{\subsection*{Presentations}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{aksin,bertram,chiu,companion,padhye,angenendt,moraux}
\printbibheading
\bibbycategory
\end{document}

enter image description here

share|improve this answer
1  
Thanks Audrey! This is exactly what I was looking for ... I am new to Latex (and BibTex, BibLatex), but, so far I love it! Hopefully, sometime in the future I'll understand the code enough to help others as you have helped me. –  Shanna Feb 6 '12 at 4:40
    
@Shanna You're welcome! Much of the code relies on commands from etoolbox. biblatex depends on this package, so we don't need to load it in the preamble. –  Audrey Feb 6 '12 at 14:41
    
i use miktex, but doesn't work.... =( –  user16869 Jul 23 '12 at 10:20
    
@ros The solution needs an extra latex run. If you have biblatex 2.0 and don't want to use biber as the backend, load biblatex with the option setting backend=bibtex. If this doesn't help, you'll have to provide some details. –  Audrey Jul 23 '12 at 14:44
add comment

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.