Friday, December 24, 2010

See the Math in HTML Documentation

The math formula in HTML doc is supposed to be viewable as PNG images. The image file translation is handled by Sphinx using Latex. For me, it doesn't work right away by specifying the 'latex' path and 'dvipng' option to conf.py.

http://sphinx.pocoo.org/ext/math.html#module-sphinx.ext.pngmath

The above explains why the README from the OpenCV/doc asked user to install 'dvipng'.

In order to get Latex support, I installed the 'tetex-bin' Cygwin package, which in turns installs python 2.6 as my default. Now I added the 'easy_install' (setuptools 0.6) for python 2.6. I also re-installed Sphinx and plasTex just in case the old version not compatible with python 2.6. And finally I used added the 'dvipng' python package with easy_install.

At this point, the first error from 'buildall' is has to do with missing 'latex.fmt' (and fmtutil.cnf/etc). It turns out that my tetex-bin' installation is too small does not cover that, as I found out that 'latex' directory is missing from /usr/share/texmf/tex/. So I do a greedy install - covering all the tetex packages, except those obviously for development purposes.

Now the error is missing 'utf8x.def' - indicating a lack of Unicode support in this Latex installation. It has to be added manually as there is no corresponding Cygwin package.

http://www.unruh.de/DniQ/latex/unicode/
It will be redirected to www.softbase.org. Follow the link to CTAN site for a unicode.zip file.

It's quite straightforward: simply unzip the unicode.tgz to /usr/share/texmf/tex/latex/. All the necessary files would be under the directory 'ucs'. Tell latex know about this by updating the /usr/share/texmf/tex/latex/ls-R file. Simply go to that directory and run 'mktexlsr'. Afterwards double-check the 'utf8x.def' is in the ls-R file.

No comments:

Post a Comment