1

I have a library with references of another book (a primary source) and analyzed on which pages (and hence how often) its sources were cited. I would like to print this data in a table.

Is it possible to use biblatex/biber to process additional fields (in this case citedonpages) to fill an additional column (and even count the comma separated entries)?

Preview of MWE

In the following MWE, I created the table manually. As the real library has many entries, an automated solution would be very helpful (in the example it would even detect multiple entries of the same pages - this would be nice but not necessary).

MWE:

\documentclass{scrbook}
\usepackage{tabularx,booktabs}
\usepackage[backend=biber,style=authortitle]{biblatex}

\begin{filecontents*}{Analysis.bib} @Book{Miller1832a, author = {John Miller}, title = {Elementary book}, year = {1832}, citedonpages = {67,67,68,97}, }

@InBook{Smith1744a, author = {Daniel Smith}, booktitle = {Collection of important articles}, location = {Amsterdam}, title = {Noteworthy Article}, year = {1744},
citedonpages = {5, 23, 37, 79, 248, 249, 254}, } \end{filecontents*} %\addbibresource{Analysis.bib}

\begin{document} \begin{refsection}[Analysis.bib] \nocite{*} \printbibliography[heading=none]

% is it possible to autogenerate this table using Analysis.bib and biber/biblatex? \begin{tabularx}{0.95 \textwidth}{llccX} \toprule {\bfseries Author} & {\bfseries Title} & {\bfseries Year} & {\bfseries # Citations} & ... on pages \\midrule%\otoprule Miller, John & Elementary book & 1832 & 4 & 67(2), 68, 97\ Smith, Daniel & Noteworthy articls & 1744 & 7 & 5, 23, 37, 79, 248, 249, 254 \ \bottomrule \end{tabularx}

\end{refsection} \end{document}

PS. useful source so far: \refsection{} environment from \nocite{*} for single bibdatasources with biblatex/biber

kromuchi
  • 2,187
  • datatype=xsvsep is not a valid declaration which makes Biber choke quite badly. format=xsv, would be valid, but all format=xsv fields also have a special datatype, which would not be applicable here, so I'd stick with datatype=literal,. That keeps things easy and since we (probably) need to do post-processing on the LaTeX side anyway, it doesn't hurt not to let Biber do any pre-processing. – moewe Aug 01 '21 at 16:23
  • A follow-up question how to use custom fields in this table can be found here https://tex.stackexchange.com/q/609226/4419 – kromuchi Aug 01 '21 at 17:22

1 Answers1

2

For a tabular bibliography you can use biblatex-ext-tabular from biblatex-ext. See Is there a easy way to put bibliography in a table?.

If you want to add new fields that are not present in the standard data model, you first need to declare them in a .dbx file. See Add field "tome" to biblatex entries.

For the data shown in the example, you will not need new fields and a separate Analysis.bib, though. biblatex can automatically collect that data, if you don't hide it in a separate refsection.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear, citecounter, backref]{biblatex} \usepackage{biblatex-ext-tabular}

\usepackage{longtable} \usepackage{array} \usepackage{booktabs}

\newcolumntype{L}[1]{% >{\raggedright\let\newline\\arraybackslash\hspace{0pt}}p{#1}} \newcolumntype{C}[1]{% >{\centering\let\newline\\arraybackslash\hspace{0pt}}p{#1}}

\newbibmacro*{tablepageref}{% \iflistundef{pageref} {} {\printlist[pageref][-\value{listtotal}]{pageref}}}

\renewbibmacro*{pageref}{}

\defbibtabular{bibtabular} {\renewbibmacro{bbx:dashcheck}[2]{##2}% \renewbibmacro{labeltitle}{}% \renewbibmacro{date+extradate}{}% \setlength{\LTpre}{0pt}% \setlength{\LTpost}{0pt}% \renewcommand{\arraystretch}{2}% \begin{longtable}{% @{} L{\dimexpr0.25\textwidth-1\tabcolsep\relax} L{\dimexpr0.3\textwidth-2\tabcolsep\relax} L{\dimexpr0.11\textwidth-2\tabcolsep\relax} L{\dimexpr0.22\textwidth-2\tabcolsep\relax} L{\dimexpr0.12\textwidth-1\tabcolsep\relax} @{}} \toprule \textbf{Author} & \textbf{Title} & \textbf{Year} & \textbf{# Citations} & \dots\ on pages\ \midrule} {\bottomrule \end{longtable}} {\anchorlang{\usebibmacro{author/editor+others}} & \plainlang{\usebibmacro{title}} & \plainlang{\printdate} & \plainlang{\arabic{citecounter}} & \plainlang{\usebibmacro{tablepageref}} \}

\addbibresource{biblatex-examples.bib}

\begin{document} Lorem \autocite{sigfridsson,worman} \clearpage Lorem \autocite{sigfridsson,nussbaum} \clearpage Lorem \autocite{sigfridsson,geer} \clearpage Lorem \autocite{worman,geer,nussbaum} \clearpage Lorem \autocite{sigfridsson}

\printbibliography

\printbibtabular[title=Analysis] \end{document}

Tabular bibliography with authors, title, year, no of citations and pages.

moewe
  • 175,683
  • Thank you for this answer. I was able to create the table using biblatex-ext-tabular and understood how to fill in general data. However, I can't use pageref to fill in the data (but must use a new data field) because I want to list the pages of another document. I tried to understand the referenced tome example, even though I declared the field with a new dbx file, I does not print the entries using \printfield{citedonpages}. – kromuchi Aug 01 '21 at 14:45
  • @kromuchi I suggest you ask a new question about citedonpages. Explain what you did and how it did not work for you. – moewe Aug 01 '21 at 14:52
  • I tried to write the question more precisely because I can't rely on backref/ pageref. How to get the manually added field with the list of pages is a crucial part of my question (next to the tabular layout that you answered already). – kromuchi Aug 01 '21 at 15:54
  • @kromuchi I would have really appreciated a new question. Asking a new question would've allowed us to focus this question on the presentation of the information in a table (which is interesting in and of itself) and a different question on the new field. – moewe Aug 01 '21 at 16:12
  • 1
    ok, I see that there are two different questions mixed together. I seperated the second question into this new question https://tex.stackexchange.com/q/609226/4419 – kromuchi Aug 01 '21 at 17:20