mathr / blog / #

Source codes in book form

Over xmas I played around with LaTeX to see about making a book of all my code. The amount of code surprised me, around 7000 pages, so I don't think I'll print it after all (print on demand would be around £1.50/volume + 2p/page for paperback, significantly more per volume hardback). It was suggested to me that microfilm would be best for long term archival, so maybe I'll think about that - it costs around 2p/page for 16+ rolls from digital, though I don't know how many pages a roll contains.

The main issue I faced when converting the code was that the listings package does not support UTF-8 properly. Yaxu posted a clean solution on stack exchange, but it involves listing each extended character with its LaTeX replacement, and Unicode has many code points. I have not tried this yet, instead using iconv to transliterate to Latin1 and hoping for the best (I also needed some mild sed to transliterate some Latin1 characters that are only valid in maths mode).

My experiments are in my code hosting, with configuration files for most of and some third-party software (mainly numerical code that I want to read):

git clone

Future work may evolve into adding hyperlinks within each PDF, so that you can click on the usage of a symbol to jump to its definition; I'd probably need to use something other than Bash to implement that, maybe Haskell has libraries for enough languages, or maybe Python (though I don't like it).

I uploaded some snapshots of my repositories.