Skip to content

wdenton/nlpltc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nlpltc: Nice-Looking Printed LibraryThing Catalogue

About

This generates a nice-looking printed catalogue for a LibraryThing library.

Example (generated from the Arts and Letters Club of Toronto library):

./nlpltc-sample.png

Requirements

  • LaTeX. The TeX Live distribution should include everything you need.
  • Ruby (and some gems).

Installation

Download the source tree and run the test to make sure it all works.

git clone https://github.com/wdenton/nlpltc.git # Not using using your GitHub account
git clone [email protected]:wdenton/nlpltc.git # Using your GitHub account
cd nlpltc
bundle install # To install necessary Ruby gems
make test

Ignore the LaTeX warnings about overfull or underfull hboxes. If it says Transcript written on catalogues/test/test-catalogue.log then it succeeded. View catalogue/test/test-catalogue.pdf to see the example PDF.

Usage

To make your own catalogue, make a copy of one of the two existing catalogues, and edit the erb template file as needed. For example, this would set things up so you would have a new catalogue template to edit:

cd catalogues
cp -r test mylib
cd mylib
mv test.tex.erb mylib.tex.erb

Next, obtain a JSON export from your LibraryThing collection. We’ll assume it’s called librarything_mylib.json. Move it into the mylib directory. Then from the top directory of this source tree, run

./nlpltc -i catalogues/mylib/librarything_mylib.json -t catalogues/mylib/mylib.tex.erb -o catalogues/mylib/mylib-catalogue.tex
pdflatex -output-directory catalogues/mylib mylib-catalogue.tex

Then view catalogues/mylib/mylib-catalogue.pdf.

For regular use, edit Makefile and add a mylib entry so you can just run make mylib.

Warning

This uses the Ruby template system ERB so that we can have a LaTeX template with embedded Ruby code to handle situations where, for example, an author name is repeated and we want to use “⸺⸺” instead of listing the name again. This results in code such as:

<% if i[:latex_author_line] == lastauthor %>------------<% else %>{\MakeUppercase{\textsf{\textbf{<%= i[:latex_author_line] %>}}}}<% end %>

Detailed formatting can be tricky because whitespace can sneak in, but if you know some LaTeX and some Ruby it’s more approachable than it looks.

History

Created at the Hackfest at the 2010 Access conference (15 October 2010, Winnipeg MB) (Wayback Machine archive). Thanks to Hackfest project partners Ganga Dakshinamurti, Wendy Huot and Rebecca Larocque. Chris Charles found and fixed a bug at Hackfest at Code4Lib North (6 May 2011, Hamilton ON).

To Do

  • Test Unicode characters.
  • Allow nlpltc mylib or the like, and it all just works.
  • Automate the getting of the export file (if you know a cookie?).
  • Do a subject listing, by tag.

About

Nice-looking printed LibraryThing catalogue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published