Featured Post

We've moved to tex.my!

It’s been great writing on Blogger.com, but we’ve decided to move to a new platform, thanks to some valuable help from a great, great friend...

Tuesday, February 28, 2012

LaTeX Training & Consultancy

I’ve recently started offering LaTeX training and consultancy services as a freelancer (between writing up my thesis and parenting). So if you happen to be sourcing for a trainer, or need a consultant for LaTeX-related typesetting or design, feel free to have a look at my webpage and contact me.

Thanks to the other blog authors for letting me post this here. I’m doing this T&C as a personal attempt, so please address your gripes just to me (Lian Tze) if you have any issues with my services, and not to the other authors here.

Thursday, February 9, 2012

Creating an Online Academic Portfolio with LaTeX and TeX4ht

This was originally asked on TeX.SX, the requirements being:

Any one know of a good script to turn a bibtex file into a nice academic portfolio that:
  • links to electronic versions where known (from url or doi)
  • works with local files (e.g. with bibdesk's format or otherwise)
  • automatically creates a thumbnail of the first page
  • and generally produces a polished web page suitable for showing off your work?

Well, I maintain my own online publication list by generating the HTML code from my BibTeX, using BibLaTeX, Biber and TeX4ht. So my answer to the above question was a quick modification of my own workflow, adding Ghostscript to the mix to generate thumbnail images of the papers. The output looks like this: (The publication lists can be split according to their types)

(BibLaTeX is a complete reimplementation of the bibliographic facilities provided by LaTeX in conjunction with BibTeX. It’s very flexible, and many find it easier to deal with compared to the BST language. Biber is the replacement of the BibTeX binary, for users of BibLaTeX.)

The source codes can be downloaded here as a .zip file. Further elaborations follow.

The Bibliography File

Back to the task at hand. First we have the BibTeX file, the content of which is pretty much the norm, except that I used the custom BibLaTeX field to hold the local PDF file name. My publications.bib contains entries like:

author = {Lim, Lian Tze and Ranaivo-Malan\c{c}on, Bali and Tang, Enya Kong},
title = {Low Cost Construction of a Multilingual Lexicon from Bilingual Lists},
journal = {Polibits},
year = {2011},
volume = {43},
pages = {45--51},
url = {http://polibits.gelbukh.com/2011_43/43-06.htm},
usera = {LLT-polibits.pdf}

The LaTeX Source File

Next is the portfolio.tex file, in which I set up a hook at every bibliography item to include the first page of the file pointed to by usera. I've also added a bibmacro called string+hyperlink, to make the publication title link to the url or doi field if these are available, as shown in this answer.




\section{My Academic Portfolio}
\printbibliography[title={Conference Proceedings},type={inproceedings}]


TeX4ht Configuration File

I then set up a TeX4ht personal configuration file, called portfolio.cfg (included in the .zip file). It contains some simple CSS, and tells TeX4ht to convert the first page of the local PDFs into PNGs using ghostscript. (So yes you will need to have ghostscript installed for this to work.)

Generating the HTML

Right, now we can run the following commands:

$  htlatex portfolio "portfolio"
$  biber portfolio
$  htlatex portfolio "portfolio"

And you should then get portfolio.html, which you can further embellish with more CSS. Well that was fun!