Previous: Shell script dependencies, Up: Conversion tools

3.3.5 Full example with the scripts


Let's assume that you want to create a book in tbook format. It is supposed to be called “mybook”. So you create a new subdirectory and enter it with

     mkdir mybook
     cd mybook

Now you must prepare the new directory for your project. Thus you enter

     tbprepare mybook

Now you can list all files in the directory with dir (Windows) or ls -l (Unix). You can see that not only the raw “make” scripts have been created, but also a tiny file mybook.xml that you can use as a beginning for your document.

Now write the document with your favourite XML or text editor. You may also rename your XML file (but leave the file extension).

Conversion to Postscript and PDF

Eventually you want to create something actually usable from your document. No problem, the command

     tbtolatex -t mybook "two-column=true"

converts mybook.xml to mybook.tex. This two-column=true means that you want to have it typeset with two columns, see XSLT parameters. The -t means that tbook should assumes that you also (later) want to convert it to HTML 4.

But first, we want to assure that all graphics used in the document are in the correct format. You have already copied all vector images in EPS format, and all bitmaps in JPEG format into the document directory, as explained in Original graphics files. Now call


which converts all JPEGs to EPS. This makes it possible to create with

     latex mybook
     dvips mybook

a Postscript version of your book called It may be necessary to call latex multiple times in order to get proper cross-referencing and table of contents.

The command


creates PDF versions of all EPS'es. Now you are ready to call

     pdflatex mybook

in order to have your book in PDF format (mybook.pdf). The first pdflatex run may show error messages because it still finds old “ordinary LaTeX” help files but you can ignore that.

Conversion to HTML

Now enter


which creates web-ready bitmaps of all your graphics. With

     tbtohtml -t mybook

you create mybook.html. You can already open that in your web browser. But it's more convenient to say


which creates a new subdirectory public-mybook and copies all web relevant stuff into that directory. Then you can zip everything in that directory and move it to your web provider. That's it.

Further stuff

If you have equations in your book, you want to have the bitmap equations created in order to see them on an HTML 4 page (remember that MathML is only possible with XHTML). You do this with


This usually takes a long time. It's very much faster if you use the preview.sty LaTeX package. See XSLT parameters, for how to achieve this.

If you have a bibliography and an index with your document, you have to call


to create them or, if they are already there, to keep them up-to-date. They create bibliography and index for the last format to which you have converted. After that, you have to convert to HTML again or call LaTeX again, respectively, to actually see the changes.