Friday, November 7, 2008

XML ¬⇒ ¬LaTeX!

One of the attractions of LaTeX is that it produces wonderful output. In all likelihood, TeX employs the best line/paragraph/page layout algorithms in the business. Furthermore, LaTeX is terrifically expressive, something I know even though my familiarity with it is limited. (I did a lot of writing with LaTeX in my academic days, but I tended to learn only enough to do what I wanted to do. Unlike many Computer Science graduate students, I never really sat down and studied it.) I know, for example, that LaTeX allows authors to float displays (e.g., figures, tables, listings, etc.) to the top of a page, the bottom of a page, or both. In fact, this is the default, meaning that unless authors disable such flexibility, LaTeX will float displays to the next "good" location. (Experienced LaTeXies know I'm lying a bit, but it's close to the truth, and the actual truth doesn't add anything here.) This behavior seemed so natural and obvious to me, I took it for granted for many years. Only when I started using less capable systems (among them FrameMaker, OpenOffice Writer, and, from what I can tell from varous comments on the web, Microsoft Word) that offered much more limited support for floats, did I realize I'd been spoiled by LaTeX.

Because LaTeX is so expressive and its output is so good, I was reluctant to dismiss it in favor of an XML-based approach such as DocBook. But then, in one of those Duh! moments that happen now and again, I realized that as long as there is a way to take a DocBook document and transform it into a LaTeX document, I could use XML as my document representation and LaTeX as my print rendering engine. In fact, I'm pretty sure that this is what the Pragmatic Programmers do: write books in PML (their book schema), then transform them into LaTeX source for ink-on-paper rendering.

Assuming this line of reasoning is valid, DocBook becomes a pretty appealing option, because it means I can take advantage of all the work done by and tools developed for the DocBook and XML communities, but I can still hold out hope for the layout quality of LaTeX. Such hope can exist only if DocBook offers sufficient expressiveness, however, because there's nothing to be gained by the possibility of using LaTeX as a rendering engine if I can't express what I want it to do via DocBook. My next step, therefore, is to install DocBook and see if it will let me say what I want to say. I already have a pretty good idea of what I want Fastware! to look like, because I've done preliminary page layout in both OpenOffice and FrameMaker. If I can get DocBook to produce the output I want, I can then try translating my recent C++ article into DocBook, which will be a good way to see if its support for floating displays, cross-references, and bibliographies is up to snuff. If so, DocBook will look like a reasonable book representation format, and I can move on to seeing whether I can find a decent WYSIWYG front end for it.

3 comments:

Keith Fahlgren said...

Why would you want a WYSIWYG front end for DocBook when you already realize the value of going to a number of formats & renderings all of which will have a different -WYG? I'd say pick a decent DocBook editor (oXygen, probably or XXE) and just try to describe your work semantically. Doing pretty typesetting from that really isn't that difficult if you're working with an experienced DocBook shop.

Anonymous said...

Scott, have you considered upgrading to a newer version of FrameMaker so that you can use DocBook with structured FrameMaker? I know you don't love Frame... but, in this scenario, you can use an EDD to take care of all your conditional formatting needs. You'd have the power of XML combined with a WYSIWYG editor that you are already familiar with; you'd just have to learn a few new features (the structured part of Frame). Might be more economical and a quicker ramp-up than LaTeX.

Scott Meyers said...

Regarding the use of FM for DocBook preparation, I got scared away from the idea by Steve Whitlatch's comments. Are there people -- happy people -- successfully using FM for DocBook documents?