I installed both a Docbook and a !LaTeX tool chain on my laptop recently. I’ve used !LaTeX for my thesis – nearly fifteen years ago. I remember forgetting more and more about it in the years that followed until I finally decided that it was just easier to write stuff on a wiki, work on the CSS stylesheet, and print to PDF if required. I got curious again and decided to make an experiment:
Here’s how it went: I quickly wrote up some stuff using my wiki. Getting it ready for the web took a few minutes, maybe half an hour of fiddling with CSS; I’m assuming I can just keep this CSS for the next time I need to convert one of my wiki pages to PDF. On the other hand, there are many things it doesn’t do: hyphenation, orphan protection when paginating, quick and easy floating boxes and images (it always needs a lot of CSS fiddling).
Using Open Office, things went just as quickly. I’m not sure I’ll be able to reproduce the exact output when I look at making my next PDF file, but it was more or less intuitive. Installing and using the Behrens-Schrift font by Dieter Steffman was trivial. The file doesn’t use quite the same font and it’s landscape instead of portrait, but my conclusions are – I hope – independent of these small differences.
Docbook was a pain to setup, but at least there were some books available online. It turns out that the one book that explains all the tags is a dry technical reference that is practically unusable when you’re starting out. When I looked at the output, I realized how tricky it was to fiddle with it. The large table at the beginning needs some more space between the cells, the four smaller tables need to be more compact. I found XSLT fragments that allowed me to set the padding for all tables, but didn’t figure out how to do this for one table only. If you look at the source file (which I edited with nXML Mode and Emacs), you’ll note that looking at the table markup is a pain. I wasn’t sure how to have two columns or floating tables for the four compact tables, so I nested tables. The markup got a lot worse. The output looks good, so that’s a plus.
LaTeX was easy to setup because my GNU/Linux distro already comes with excellent packages. LaTeX documentation for beginners, however, is hard to find. Where do I learn about the basics? I see that the texlive-doc-en package has a “gentle” document somewhere. Maybe someday! I fell back to my “!LaTeX Einführung Band 1” by Helmut Kopka – the second printing, 1996 – it has a price in Deutsche Mark instead of Euros, that’s how old it is. I was surprised to see how ugly the table turned out, and I have no idea on how to improve that. The source doesn’t look too hot either. Very cryptic. (I edited it using AUCTeX and Emacs.)
I will be using Open Office! :attention:
It hurts my markup sensibilities, but if I want to get stuff done, I can’t waste it on Docbook and !LaTeX.
Update: I returned to rst2pdf again and tried it. It took me quite a while to get the font importing right. But I think it finally worked! The command used:
rst2pdf chargen.rst -s style.json --font-path ~/.fonts (the font-path is where I installed the fonts I got from elsewhere).
Suddenly I’m no longer sure. ReST seems quite a viable solution. And I've started playing around with the style sheet... Not bad The only question I could not answer was how to center the first column of my tables.
Update: I’ve returned to LaTeX in 2013.
I was looking for an alternative to LaTeX. I recently learned how to setup DocBook. There’s a book explaining what DocBook is and how to use it; the old version of the book is available online. I also followed the instructions in the DocBook XSL book on how to install FOP, so in theory I had the entire tool chain to write an XML file, translate it to FO format using
xsltproc and translating that to PDF format using
It looked very ugly. I felt like going back to LaTeX – and that’s pretty ugly, too!
I found that by default, FO processors only know about Times Roman, Helvetica, and Courier by default. So I decided to try and get the article font switched to Garamond before continuing my delve into Docbook. I got followed the instructions on adding a font and wasted some time tracking down jar files that were not needed and tracking down a copy of the Garamond font I could embed. In the end I got it all working! I had an ugly document, but it was A4, two columns, had some bold, and some italic, and my name on it.
But I also felt that maybe – just maybe – LaTeX and OpenOffice were not such a bad ideas after all.
Maybe I should just stick to OpenOffice and focus on getting things done.
all: test.pdf %.fo: %.xml Makefile xsltproc \ --output $@ \ --stringparam fop1.extensions 1 \ --stringparam paper.type A4 \ --stringparam column.count.body 2 \ --stringparam body.font.family Garamond \ /usr/local/share/xml/docbook-xsl/fo/docbook.xsl \ $< %.pdf: %.fo fop -c garamond.xml -fo $< -pdf $@ # Garamond # curl http://garamond.org/font/urw/GaramondNo8.Files.txt | xargs wget fonts: GaramondNo8-Ita.xml GaramondNo8-MedIta.xml GaramondNo8-Med.xml GaramondNo8-Reg.xml GaramondNo8-%.xml: GaramondNo8-%.ttf java -cp "/usr/local/share/xml/fop/build/fop.jar:/usr/local/share/xml/fop/lib/commons-io-1.3.1.jar:/usr/local/share/xml/fop/lib/commons-logging-1.0.4.jar:/usr/local/share/xml/fop/lib/xmlgraphics-commons-1.3.1.jar" \ org.apache.fop.fonts.apps.TTFReader \ $< $@
/usr/local/share/xml/fop is a symlink to
garamond.xml I also had to write:
<fop version="1.0"> <renderers> <renderer mime="application/pdf"> <fonts> <font metrics-url="GaramondNo8-Ita.xml" kerning="yes" embed-url="GaramondNo8-Ita.ttf"> <font-triplet name="Garamond" style="italic" weight="normal"/> </font> <font metrics-url="GaramondNo8-Med.xml" kerning="yes" embed-url="GaramondNo8-Med.ttf"> <font-triplet name="Garamond" style="normal" weight="bold"/> </font> <font metrics-url="GaramondNo8-MedIta.xml" kerning="yes" embed-url="GaramondNo8-MedIta.ttf"> <font-triplet name="Garamond" style="italic" weight="bold"/> </font> <font metrics-url="GaramondNo8-Reg.xml" kerning="yes" embed-url="GaramondNo8-Reg.ttf"> <font-triplet name="Garamond" style="normal" weight="normal"/> </font> </fonts> </renderer> </renderers> </fop>
Uhm… That’s it, I think.
My test file:
<?xml version="1.0"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <article> <artheader> <title>My Article</title> <author><firstname>Alex</firstname> <surname>Schroeder</surname></author> </artheader> <sect1><title>Testing</title> <para>This is an ordinary paragraph with some <emphasis role="bold">bold</emphasis> and <emphasis>italic</emphasis> words.</para> </sect1> </article>
Oh, and this required the installation of the DocBook 4.5 XSL files and an entry in my catalog file. I got it from here: http://www.oasis-open.org/docbook/xml/4.5/ and followed my own instructions on how to update the catalog file.
All of this seems mighty complicated compared to just starting OpenOffice and writing a document or two. Sure, I don’t like working with it. But I don’t like working with all these arcane files and formats either. I can already see myself trying to get a title page or a little table just right in a three page document. It’ll never be worth my time. I’d be a gazillion times faster using Emacs and plain text!
Yeah, I know. Why the hell am I still using Mac OS 10.4 instead of upgrading – or moving to a Debian system? I dunno!
So I was trying to compile the ui-fix branch for BitlBee. It includes the killerbee branch, so it uses libpurple and all that.
LDFLAGS=-lintlin the Makefile to compile it.
I wasted a lot of time on this.
This is so sad.
The sun was shining, too.
I was unable to find something prepackaged for me. So I started to follow the instructions in DocBook XSL: The Complete Guide.
Installing the DocBook DTD – xmlto doesn’t use the latest one so I got version 4.2 – http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip and unpacked it. I wanted everything in
/usr/local/share/xml so that’s what I did –
sudo mv docbook-xml-4.2 /usr/local/share/xml…
Installing the DocBook stylesheets – so now we need stylesheets to create the manpages. I got the following file: http://sourceforge.net/projects/docbook/files/docbook-xsl-ns/1.75.2/docbook-xsl-ns-1.75.2.tar.bz2/download and used
sudo mv docbook-xsl-ns-1.75.2 /usr/local/share/xml…
How to write an XML catalog file – next I needed to write the catalog for the minimum stuff I needed. I created a the file
/usr/local/share/xml/docbook.cat with the following content:
<?xml version="1.0"?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <group prefer="public" xml:base="file:///usr/local/share/xml/" > <public publicId="-//OASIS//DTD DocBook XML V4.2//EN" uri="docbook-xml-4.2/docbookx.dtd"/> <rewriteURI uriStartString="http://docbook.sourceforge.net/release/xsl/current/" rewritePrefix="docbook-xsl-ns-1.75.2/" /> </group> </catalog>
I set the environment variable in my .bashrc:
And with that,
make xmlto and
make bitlbee worked!