💾 Archived View for republic.circumlunar.space › users › johngodlee › posts › 2019-11-25-library.gmi captured on 2023-06-14 at 14:51:37. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-04)
-=-=-=-=-=-=-
DATE: 2019-11-25
AUTHOR: John L. Godlee
I have books split between my parents' house and my house and sometimes I would like to check whether I have a certain book, in order that I can lend it to someone or read up on something specific. To make this process of finding books easier I decided to create a digital personal library catalogue. I decided to use BibTeX to construct the catalogue, because it's a system I know pretty well from writing LaTeX research papers and keeping my bibliography of academic papers.
Other options I explored briefly before returning to BibTeX were:
Apart from it being the option I was most confident in using, I also know that BibTeX .bib files are just plain text, so I know they will always be parse-able in the future. There is also a good amount of associated software for BibTeX files that has grown up around document formatting, LaTeX and Pandoc.
One issue with BibTeX is that it is not robustly specified. There are many optional fields and different ways of formatting the contents of each field, and this can cause things to break with certain bibliography styles and with different bibliography managers, which almost always format things incorrectly. I recently came across this article[4] which I think sums up many issues with BibTeX and attempts to impose some order.
4: https://serialmentor.com/blog/2015/10/2/Bibtex
I learnt that the ISBN (International Standard Book Number) was introduced in 1970 originally as a 10 digit code, which was later expanded to a 13 digit code gradually between 2005 and 2007. This means that for most books in my library, I can easily check their bibliographic information by running the ISBN through an online service such as this tool by Robert Eisele[5] which generates a BibTeX entry from an ISBN.
5: https://www.xarg.org/tools/isbn-to-bibtex/
I decided on a consistent BibTeX entry to use with my personal library:
@book{Willock1974, editor = {}, author = {Willock, C. and Plage, G. D.}, title = {Africa's Rift Valley}, year = 1974, publisher = {Time Life UK}, address = {London, UK}, isbn = {0705400964}, lc = {QH195.R53 W54} }
ost of this is self-explanatory. There are optional fields for the book entry:
But I found that I really didn't need most of these identifiers, with most books in my collection not having any of them. note I may choose to use later to add searchable terms to certain books.
I would like to present my personal library on my website, my gopherhole and as a nicely formatted .pdf. I could probably use pandoc for all of these tasks, but adding a shell script and a few templates isn't hard either. This is the shell script:
#!/bin/bash latexmk -pdf books.tex pandoc --filter pandoc-citeproc --csl /Users/johngodlee/.texmf/apa.csl --standalone books.md -o books.html pandoc -f html -t plain --columns=68 -o books.txt books.html
This first creates books.pdf using latexmk. I used a latex template called books.tex:
\documentclass{article} \usepackage{mynotes} \renewcommand\refname{} \title{Bibliography} \date{} \begin{document} \maketitle{} \nocite{*} \bibliography{books} \end{document}
The magic command is \nocite{*} which includes a bibliographic entry for every item in books.bib, regardless of whether it is cited in the text.
The shell script then uses pandoc and pandoc-cireproc to create books.html, using a custom .csl file which formats the references in generic APA style. I downloaded apa.csl from this Github repo[6]. I had to use a markdown template (books.md) to get the references to display properly:
6: https://github.com/citation-style-language/styles
--- bibliography: books.bib nocite: "@*" title: "Library" ...
Pandoc is then used to re-format the html as plain text for use on my gopherhole. I couldn't go straight from markdown to plain text and get the references to display. I guess the nocite: "@*" is ignored in that case.
The references in the plain text look like this:
Allen, M. F. S. (2003). Portuguese in 3 months. London, UK: Dorling Kindersley. Auden, W. H. (1968). Selected poems. London, UK: Faber; Faber. Bates, L., & Sheers, O. (2018). Letters to the future: On equality and gender. Hay-on-Wye, UK: Hay Festival Press. Beaujean, A. A. (2014). Latent variable modeling using r. New York NY, USA: Routledge.
And in .html they look like this:
<div id="ref-Allen2003"> <p>Allen, M. F. S. (2003). <em>Portuguese in 3 months</em>. London, UK: Dorling Kindersley.</p> </div> <div id="ref-Auden1968"> <p>Auden, W. H. (1968). <em>Selected poems</em>. London, UK: Faber; Faber.</p> </div> <div id="ref-Bates2018"> <p>Bates, L., & Sheers, O. (2018). <em>Letters to the future: On equality and gender</em>. Hay-on-Wye, UK: Hay Festival Press.</p> </div> <div id="ref-Beaujean2014"> <p>Beaujean, A. A. (2014). <em>Latent variable modeling using r</em>. New York NY, USA: Routledge.</p> </div>
y personal library can now be found here, on my website[7].