[Tex/LaTex] Citing a certain type of reference using biblatex

biblatexsubdividing

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?

Best Answer

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

Related Question