Archive for the ‘LaTeX’ Category.


I’ve been a big fan of the package management system in Debian ever since began using it. It’s the most complete and carefully maintained system I’ve seen for this.

But apart from their package management system, Debian is also famous (or should we say infamous :-) for their strict demands on the licensees of the programs in the distribution: They will only distribute programs that are truly free. I was reminded of this today when I tried to compile the dADS report with LaTeX — it complained about missing files. I discovered that they had removed several LaTeX packages because the files weren’t licensed properly!

They have removed these files: algorithm.sty, algorithmic.sty, beton.sty, booktabs.sty, caption.sty, euler.sty, footbib.sty, fvrb-ex.sty, picinpar.sty.

I’m actually using 6 of these packages/files at the moment, so that was kind of bad for the document :-) But it only took a couple of minutes to download them again from CTAN. I’ve now placed the packages in my own texmf-tree in my home directory so that they’ll be preserved next time the good guys at Debian decides to change something.

Xy-pic is cool!

Image produced by Xy-pic The image you see on the right was made with the Xy-pic macros for TeX. It’s surprisingly easy to make complicated pictures like the one on the right using Xy-pic, and because it’s a package for [LaTeX][] it’s easy to include mathematics in the diagrams.

I discovered the wonderful Xy-pic by reading a note about LaTeX made by Lars Madsen, take a look here: There’s a lot of really good stuff in the note, so if you’re trying to learn LaTeX and want some Danish material to get started with, then you should definitely take a look at it.

You should also read The no so Short Introduction to LaTeX by Tobias Oetiker for even more information about LaTeX. It covers everything you’ll need to know to get started using LaTeX.

Making Fractals with MetaPost

Sierpinski's Sieve rendered with MetaPost I’ve played a lot with MetaPost today — I’ve been making fractals. It’s a lot of fun to make graphics with MetaPost, and making the fractals was no exception.

I’ve made three kinds of fractals: Koch Curves, Hilbert Curves and finally the one shown at the right, Sierpinski’s Sieve. The last one is also know as Sierpinski’s Triangle, for obvious reasons.

You can download the sourcecode and a document here: /downloads/metafractals/. If you’re trying to remake the document, then please note that the images are called filenameN.mps instead of just filename.N. This is because PDFLaTeX works best with those filenames. So you’ll have to rename the files generated by MetaPost before running LaTeX/PDFLaTeX. If you’re running Zsh, then you could use this very little shell-script:

for basename in $*; do
    mpost $basename
    for file in ${}.<0->; do
        mv $file ${file/./}.mps

Making documentation for PHP Weather

I’ve been playing a lot lately with a lot of exciting technologies, such as XML. I wanted to produce some nice documentation for PHP Weather. I then thought of Docbook. But I’ve never used Docbook before — I hardly knew what it was.

So I tried writing a little, and I produced both

HTML and PDF files. But it looks awful! The lines are not justified, the font used is Times, etc. Compared with LaTeX I didn’t like it. I know that I can change these things, and I did manage to change the font to Palatino, but it still didn’t look “right”.

So I set out to try and use the XML-files produced by PHPDoc to make code for LaTeX. First I tried using a XSLT stylesheet to transform the XML code. That worked a little, but it wasn’t powerful enough — you can do some simple things, but not nearly enough.

So I then decided to do it myself with the aid of PHP. At first I had a really hard time figuring out how to parse the data properly. PHP can parse XML, but you’re only given three events to react on: open-tags, character-data, and close-tags. You have to do the rest… But I managed to find a solution, so now I have a nice script called phpdoc2latex.php that does what it says it does: converts XML files produced with PHPDoc into LaTeX code. You can see the result in the CVS repository.

As you can see, I’ve added some extras to the doc-comments :-) The really nice graphs are made with an amazing program called Dot from the Graphviz package.

The final written exam

I’ve just finished my final written exam! I’ve spend five hours trying to write a Danish essay, and I think the result was pretty good.

I used my dads notebook with Windows and Word. I did this, just to remind myself of why it is, that I’ve spend countless hours reading manuals and books for LaTeX. Why have I spend entire evenings trying to achieve a particular effect in LaTeX? Now that I’ve started to use Metapost, I’ve also had to read the manual for that — it’s large but really good. The question remains: why do I do it.

The answer just occurred to me today: Word is full of bugs! It’s a faulty, PITA-program! It crashed on my today, even though I didn’t do anything fancy. I wasn’t playing with a lot of OLE-objects, nor was I trying to do anything else. I was just writing an essay with perhaps three different fontsizes. But when I tried to change the size of the skip after paragraphs, it just died. And it did this several times.

So, luckily there won’t be a next time, but if I ever have to write something important on a computer, I’ll use LaTeX. It’s the only program that I know of, that if reliable. It might be a little difficult to do some of the more advanced things, but if you’re just writing a plain essay, then it’ll never let you down. It was only because it was easier for me to transport the notebook that I used it instead of my normal machine.