[Tex/LaTex] Bibliography with subbibliographies with biblatex

biblatexsubdividing

What is the best way to make bibliography with multiple levels in biblatex? Concretely, someone wanted to have bibliography of his own papers, where under each of them is the list of papers that cited him.

It should look that way:

  1. Author, Article 1,Journal.
    Cited by

    1. Another author, Article
    2. Another author 2, Article bla bla
  2. Author, Article 2, Journal
    Cited by

    1. Another author 3,…

I came with solution which uses custom field usera in author's records. There is a list of comma separated citekeys of citing works and in bibliography I use fullcite for their printing. There is my code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage[]{tgschola}
\usepackage[
     style=numeric
    ,backend=bibtex
    ,defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Sh:1,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Israel Journal of Mathematics},
review = {MR 40-7102},
pages = {187--202},
title = {Stable theories},
volume = {7},
year = {1969},
keywords={own},
usera={Sh:4, Sh:5, Sh:6}
},

@article{Sh:2,
author = {Shelah, Saharon},
ams-subject = {(05.04)},
journal = {Journal of Combinatorial Theory},
review = {MR 39-2652},
pages = {298--300},
title = {Note on a min-max problem of Leo Moser},
volume = {6},
year = {1969},
keywords={own}
},

@article{Sh:3,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Annals of Mathematical Logic},
review = {MR 44-2593},
pages = {69--118},
title = {Finite diagrams stable in power},
volume = {2},
year = {1970},
keywords={own},
usera={Sh:7, Sh:8, Sh:9}
},

@article{Sh:4,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Journal of Symbolic Logic},
review = {MR 44-52},
pages = {73--82},
title = {On theories $T$ categorical in $|T|$},
volume = {35},
year = {1970},
},

@article{Sh:5,
author = {Shelah, Saharon},
ams-subject = {(02.35)},
journal = {Israel Journal of Mathematics},
review = {MR 41-6674},
pages = {75--79},
title = {On languages with non-homogeneous strings of quantifiers},
volume = {8},
year = {1970},
},

@article{Sh:6,
author = {Shelah, Saharon},
ams-subject = {(02.50)},
journal = {Pacific Journal of Mathematics},
review = {MR 42-2932},
pages = {541--545},
title = {A note on Hanf numbers},
volume = {34},
year = {1970},
},

@article{Sh:7,
author = {Shelah, Saharon},
ams-subject = {(02H13)},
journal = {Journal of Symbolic Logic},
review = {MR 48:3735},
pages = {83--84},
title = {On the cardinality of ultraproduct of finite sets},
volume = {35},
year = {1970},
},

@article{Sh:8,
author = {Shelah, Saharon},
ams-subject = {(02H05)},
journal = {Israel Journal of Mathematics},
review = {MR 46:1581},
pages = {193--198},
title = {Two cardinal compactness},
volume = {9},
year = {1971},
},

@article{Sh:9,
author = {Shelah, Saharon},
ams-subject = {(02.52)},
journal = {Annals of Mathematical Logic},
review = {MR 44-56},
pages = {441--447},
title = {Remark to ``local definability theory'' of Reyes},
volume = {2},
year = {1970},
},

\end{filecontents}
\addbibresource{\jobname.bib}

\defbibfilter{own}{keyword=own} % Authors publications must have set keyword to "own"


\DeclareFieldFormat{usera}{% 
\fullcite{#1}\addperiod
}

\renewbibmacro*{finentry}{%
  \finentry
  \ifbibliography
    {\usebibmacro{entrytail}}
    {}%
  }

\newbibmacro*{entrytail}{% 
\newunit\newblock
\iffieldundef{usera}{}{%
\begingroup
\par Cited by:\par
\renewcommand\multicitedelim{\addperiod\item\nopunct} 
\begin{enumerate} % 
\item%
\printfield{usera} 
\end{enumerate}
\endgroup
}
}
\begin{document}
\nocite{*}
\printbibliography[filter=own]
\end{document}

Author's records must have set keywords to "own" and they are printed in bibliography using

\defbibfilter{own}{keyword=own}
...
\printbibliography[filter=own]

I redefined macro finentry to end entry, print text cited by and to use fullcite with content of the field usera. Fullcite by default print fields delimited with semicolon, so I redefined multicitedelim to

\renewcommand\multicitedelim{\addperiod\item\nopunct}

Result looked something like this:
Note dot before last entry

Now I have two questions:

  1. Doesn't exist some better or cleaner way to achieve what I want? For example using entrysets?

  2. I have problems with dots, I use \nopunct to avoid them, but this prints unwanted spaces. And how to portably avoid them at beginning of entries? This must be some issue with punctuation tracker, but I can't see from where they are comming.

Best Answer

The biblatex manual states that \finentry should used at the end of every entry. Applying this rule resolves the spacing issue. Another problem is that the keys in usera aren't being treated as separate items in enumerate. To fix this you can iterate on each key using \forcsvfield.

Entries in the same set are printed in a similar manner; the command \entry{<precode>}{<postcode>} executes <precode>, the bibliography driver and then <postcode> for each @set entry. So an alternative using entry sets isn't obvious.

I've updated the answer to resolve some additional spacing issues and allow you to specify the author of "own papers" in the tex file. The "cited by" entries and their print order still needs to be specified in the bib file, unfortunately.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[defernumbers=true]{biblatex}
\usepackage{filecontents}

% Variants of each could be added
\newcommand{\firstinit}{D.~E.}
\newcommand{\firstname}{Donald~E.}
\newcommand{\lastname}{Knuth}

\begin{filecontents}{\jobname.bib}
@Book{knuth:new,
  hyphenation = {american},
  sortyear = {1984-0},
  sorttitle = {Computers & Typesetting},
  author = {Knuth, Donald E.},
  title = {Computers \& Typesetting},
  volumes = {5},
  publisher = {Addison-Wesley},
  location = {Reading, Mass.},
  date = {1984/1986},
  usera = {companion,bertram,reese}}
\end{filecontents}
\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}

\DeclareBibliographyCategory{byname}

\newcounter{bynamecount}
\setcounter{bynamecount}{0}

\DeclareIndexNameFormat{byname}{% Test could be refined
  \ifboolexpr{ test {\ifdefstring{\lastname}{#1}}
               and ( test {\ifdefstring{\firstname}{#3}}
                     or test {\ifdefstring{\firstinit}{#4}} ) }
    {\addtocategory{byname}{\thefield{entrykey}}%
     \addtocounter{bynamecount}{1}}
    {}}

\defbibcheck{byname}{%
  \indexnames[byname]{author}%
  \ifcategory{byname}
    {}
    {\skipentry}}

\renewbibmacro*{finentry}{%
  \finentry%
  \ifbibliography
    {\iffieldundef{usera}
      {}
      {\vskip\bibitemsep Cited by:
       \begin{enumerate}
         \forcsvfield{\itemcite}{usera}
       \end{enumerate}}}
    {}}
\newcommand*{\itemcite}[1]{\item \fullcite{#1}\finentry}

% Adjust horizontal spacing - necessary only when the initial 
% labelnumbers of entries in byname are large
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\newlength{\maxlabelnumberwidth}
\settowidth{\maxlabelnumberwidth}{\mkbibbrackets{\arabic{bynamecount}}}
\defbibenvironment{byname}
  {\list
     {\printfield[labelnumberwidth]{labelnumber}}
     {\setlength{\labelwidth}{\maxlabelnumberwidth}%
      \setlength{\leftmargin}{\maxlabelnumberwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\begin{document}
\nocite{*}
\printbibliography[check=byname,env=byname]
\end{document}

enter image description here

Related Question