Saturday, September 09, 2006

Linux: Working with DocBook

I've been reviewing a manuscript for Prentice-Hall. Originally they sent me a PDF file with the entire book. This was great for me since it was fairly portable. However, due to a unexpected hardware glitch (aka Hard Disk crash), I lost that manuscript. When I requested another, they sent me a series of XML files, which as it turns out, are DocBook formatted. I have never worked with DocBook before, so I needed some way to make these files usable for me.

When I went to parse the documents using the DocBook tools available under Ubuntu, I found a build.xml file, which is the tell-tale sign of an Ant build file. This changes everything. So I verified that this was indeed an Ant build file when I opened the document. To install Ant I ran the following command:

sudo apt-get -f install ant

Once done, I ran ant in the books source folder, however I received an error about missing the Apache FOP packages. When I looked inside of the build.xml file, I found that the version of FOP expected was 0.20.5. This was available from here.

There were also some other dependencies, such as the Java Advanced Imaging SDK, and the proper DocBooks XSL files that the build was expecting (the versions installed with apt-get proved to be inappropriate). So I had had to grab the following packages:


DocBooks (Latest) and DocBooks XSL 1.68.1:

Once I correctly modified the build.xml file to point to the appropriate locations for these libraries (it was previously pointing to folders under a Windows directory structure, and since I am running Ubuntu, that didn't quite translate correctly), it compiled without a problem using the PDF option. I ended up with a Pdf file so now I can review the book as it is intended to look in print.

This proved to be a bit educational. I had read about using LaTeX for typesetting before, but this was my first hands-on experience with an actual setup for one. This was a bit of an eye opener for me since I had previously just thought that modern books were just done from a word processor and went straight to print that way, however that doesn't seem to be the case. It seems kind of strange that making a copy of a book is somewhat like compiling a program in the sense that it uses Build files, Java classes and such. Very interesting.

No comments: