0

One thing I dislike about bibliography styles is that sometimes information is lost and some citation styles make it difficult to link the citation and the entry in the bibliography. An extreme reaction would be to print the .bib file used in place of the bibliography, not run biber or bibtex and leave the unformatted entries in \textcite and friends.

Is a slightly nicer version achievable in BibLaTeX?

\documentclass{article}
\usepackage{biblatex}

\begin{filecontents}{\jobname.bib}

@article{Seshadrinathan2010A-Subjective-St,
    Author = {K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack},
    title={foo},
    year={2011},
    journal={bla}
}

@article{Seshadrinathan2009Study-of-Subjec,
    Author = {K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack},
    title={bar},
    year={2010},
    journal={bla}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

Some words \textcites{Seshadrinathan2010A-Subjective-St}{Seshadrinathan2009Study-of-Subjec}.

\printbibliography

\end{document}

Some words Seshadrinathan2010A-Subjective-St and Seshadrinathan2009Study-of-Subjec.

Bibliography

@article{Seshadrinathan2010A-Subjective-St,

    Author = {K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack},

    title={foo},
    year={2011},
    journal={bla}
}

@article{Seshadrinathan2009Study-of-Subjec,
    Author = {K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack},
    title={bar},
    year={2010},
    journal={bla}

or perhaps

Bibliography

Seshadrinathan2010A-Subjective-St:

author: K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack

title: foo

year: 2011

journal: bla

Seshadrinathan2009Study-of-Subjec

author: K. Seshadrinathan and R. Soundararajan and A. C. Bovik and L. K. Cormack

title: bar

year: 2010

  • 2
    Can you describe in more detail what you want? If you get bold 'Seshadrinathan2010A-Subjective-St' in your document, you did not run Biber on your document and the citations do not look as expected. You also forgot \addbibresource{\jobname.bib} in your MWE. Question mark or bold citation key instead of citation number and Biblatex with Biber: Configuring my editor to avoid undefined citations. – moewe Feb 20 '18 at 14:15
  • Sorry, I understand how to run biber normally for a document. What I'm after is an esoteric bibliography style that instead of styling the entries simply prints the BibTeX entries verbatim. The citestyle may be different, but the way they're printed when biber is not run is actually satisfactory I think. – Hugh Feb 20 '18 at 14:18
  • If I add the missing \addbibresource{\jobname.bib} in your example and compile it with LaTeX, Biber, LaTeX, LaTeX I obtain i.stack.imgur.com/PHzJQ.png Which looks informative enough. – moewe Feb 20 '18 at 14:19
  • LaTeX's defaults are very good, and I'm being picky, but for example the names are collapsed in et al. and the forename is suppressed. I know I can use options to biblatex like maxcitenamesto fix each of those things, but distinguishing between the notes field and the address field is harder. – Hugh Feb 20 '18 at 14:22
  • 1
    The only time that "sometimes information is lost" from a given entry is if the entry contains fields that aren't appropriate for a given entry type. E.g., if an entry of type @book contains a field named journal, then both biblatex and bibtex will -- correctly! -- ignore the field, and its contents will end up being "lost". But I'd say that this is exactly as it should be: the mere fact that some fields are getting lost might be a clue that there are errors that must be fixed. The real remedy is to change either the entry type (to @article?) or the field name (to booktitle, maybe). – Mico Feb 20 '18 at 14:31
5

Mico makes some very good points when he questions the motivation behind this approach.

As you can see the output is rather overwhelming and a reader might simply get lost in the wall of information you inflict upon her. A well chosen bibliography style will make it much easier for your readers to find what they are looking for. Even dropping the entire .bib file on your reader can not guarantee that you have not made mistakes that might cause confusion or hinder your readers to find the correct citations. The only situation in which the .bib file gives your reader an advantage over the output in the bibliography as produced by a proper style arises when your .bib entries don't conform to biblatex's data model, but you are easily warned of that with biber --validate-datamodel. All in all, the disadvantages of simply showing the entire .bib file should outweigh the advantages: I certainly have never seen anyone attempt to pass their .bib file off as a proper bibliography in a paper or textbook.


That said, you can use the debug style

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=debug]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson}
\printbibliography
\end{document}

enter image description here

This style only lists fields that are known to biblatex and Biber in the data model. If you use weird fields or have a typo in the field name, they are gone. Of course biber --validate-datamodel warns you about this.


Just for fun, here is a solution that comes closer to what you originally intended.

Run LaTeX with shell escape enabled twice on the following. There is o need for further Biber runs, the required runs are already done via the shell escape. If you decide to additionally run Biber normally, the citations will turn from bold to their normal form in style=debug as shown above. If you decide not to run Biber as normal, you will of course be met with warnings that remind you to run Biber again, but you can ignore these warnings.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=debug]{biblatex}
\usepackage{listings}
\lstset{basicstyle=\ttfamily, breaklines=true}
\addbibresource{biblatex-examples.bib}

\usepackage{filecontents}
\begin{filecontents*}{onlycitedsort.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_align>true</output_align>
  <output_fieldcase>lower</output_fieldcase>
  <output_safechars>1</output_safechars>
  <sorting>
    <sort order="1">
      <sortitem order="1">entrykey</sortitem>
    </sort>
  </sorting>
</config>
\end{filecontents*}

\IfFileExists{\jobname.bcf}
  {\immediate\write18{biber --output_format=bibtex \jobname.bcf}%
   \immediate\write18{biber --tool --configfile=onlycitedsort.conf \jobname_biber.bib}}
 {\typeout{Please rerun LaTeX.}}

\begin{document}
\cite{sigfridsson,worman,geer,cicero,vizedom:related}
\IfFileExists{\jobname_biber_bibertool.bib}
  {\lstinputlisting{\jobname_biber_bibertool.bib}}
  {empty bibliography}
\end{document}

to obtain

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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