Feb 05

LaTeX Nirvana

Posted in latex, comments: 5

I'm no fan of Word or OpenOffice for that matter, all that WYSIWYG stuff is not for me. For years now I'm using LaTeX for my editing needs. An added bonus for using LaTeX is that the output is stunning.

But for really nice looking output I wanted the following:

  • Fonts in images/graphics should match the font of the main document
  • TrueType fonts, instead of the standard TeX fonts. To avoid the "Heeh, that looks like a LaTeX document"-reactions;
  • UTF-8 support and international character support;
  • Easy integration of images (SVG based);
  • Automatic building.

I'm using the following tools for this:

  • Inkscape and pdfcrop for graphics generation;
  • make for building;
  • VI for editing (with syntax highlighting);
  • evince as PDF viewer;
  • xelatex for building the pdf.

General setup

As said earlier, I'm a fan of the memoir class as a replacement of the standard LaTeX classes. So I'm using it here again. When you are using xelatex (better UTF-8 support) you should also include the package xltxtra and xunicode.

Fonts

The package for TrueType font support is fontspec, to keep the math fonts working I had to include the package as \usepackage[cm-default]{fontspec}.

Note: fontspec mandates xelatex.

To use special characters I also found the pifont package. In my current working document I use the Liberation Fonts and Courier New:

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[SmallCapsFont={* Caps}]{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[SmallCapsFont={Courier New}]{Courier New}
\fontsize{10}{10}

LaTeX will make TrueType fonts slightly larger than its core fonts, the Scale=MatchLowercase tries to remedy that.

Graphics

I'm using Inkspace to draw my graphics, an added bonus for using TrueType fonts in my LaTeX documents is that I can use the same fonts in the Inkspace drawings. So any text I add will be of the font Liberation Serif at 10 points.

Further more Inkscape has the nice feature that it can be used on the command line

$ inkscape --export-pdf=drawing.pdf drawing.svg

generates the pdf file. To make it fit in the document we need to crop the resulting pdf

$ pdfcrop drawing.pdf output.pdf && mv output.pdf drawing.pdf

And now we are left with a nice, cropped, pdf. See this link on how to include graphics in your LaTeX document, I just use:

\begin{figure}[h!b]
\includegraphics{drawing.pdf}
\caption{Fake caption line.}
\end{figure

Which will probably be extended somewhat to allow for cross references (search for \label and \ref).

Building

To help in the sometimes tedious building of LaTeX documents, I use make. For instance creating the pdf graphic files from the svg source files is done with the following Makefile:

pdfs := $(patsubst %.svg,%.pdf,$(wildcard *.svg))

%.pdf: %.svg
    inkscape --export-pdf=$@ $<
    pdfcrop $@ output.pdf && mv output.pdf $@

all: ${pdfs}

clean:  
    rm -f *.pdf

The only thing I need to do is to create a file with Inkscape, save it and run make.

For the document itself I'm using a similar, small Makefile.

.PHONY: fig

all:    fig go.pdf

go.pdf: go.tex go-setup.tex chapter*.tex ex*.tex src/*.go 
    xelatex go.tex && xelatex go.tex

fig:    fig/*.svg
    ( cd fig; make all )

clean:
    rm -f go.lol go.aux go.log map.log go.pdf
    ( cd fig; make clean )

Putting it all together

Next to the above Makefiles I have the following in the preamble:

\documentclass[a4paper,openany]{memoir}
\usepackage[cm-default]{fontspec}% provides font selecting commands
\usepackage{xunicode}% provides unicode character macros
\usepackage{xltxtra} % provides some fixes/extras
\usepackage[answerdelayed,lastexercise]{exercise}
\usepackage{pifont}
\usepackage{caption}
\usepackage{alltt}
\usepackage{url}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[SmallCapsFont={* Caps}]{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[SmallCapsFont={Courier New}]{Courier New}
\fontsize{10}{10}
\graphicspath{{fig/}} % set default import pat

% among other \newcommands the follow environment for
% indented alltt (verbatim) text
\newenvironment{display}{%
  \def\FrameCommand{\hskip\parindent}%
  \MakeFramed {\advance\hsize-\width \FrameRestore}%
  \small
  \begin{alltt}
  }%
{\end{alltt}\endMakeFramed}

My master text go.tex used \input to include all other pieces of text, so there I have:

\chapter{Intro}
\input{chapter-intro.tex}

This keeps the main document file nice and clean and you can easily re-arrange entire chapters. After any significant change I just run make and view the resulting pdf file with evince, which is an awesome pdf viewer btw. It looks something like this:

Screenie of sample page

The very-much-work-in-progress pdf can be seen here.


Jan 28

DNSSEC in de root van DNS

Posted in dutch, dns(sec), comments: 1

Ik ben ongeveer 4 jaar geleden gestopt bij NLnetLabs, omdat ik DNSSEC wel een beetje zat was en het zou waarschijnlijk nog jaren duren voordat DNSSEC op het hoogste niveau ingevoerd zou gaan worden.

Maar nu lijkt het toch bijna zover te zijn. Ben benieuwd wanneer we echt overstappen en er een officiele DNSSEC root key wordt gedistribueerd.

% dig . @l.root-servers.net dnskey 

; <<>> DiG 9.5.1-P2.1 <<>> . @l.root-servers.net dnskey
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64132
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;.              IN  DNSKEY

;; ANSWER SECTION:
.           86400   IN  DNSKEY  256 3 8 AwEAAa1Lh++++++++++++++++THIS/IS/AN/INVALID/KEY/AND/SHOULD
/NOT/BE/USED/CONTACT/ROOTSIGN/AT/ICANN/DOT/ORG/FOR/MOR E/INFORMATION+++++++++++++++++++++++++++++++++++++++++++ +++++++8
.           86400   IN  DNSKEY  257 3 8 AwEAAawBe++++++++++++++++THIS/IS/AN/INVALID/KEY/AND/SHOULD
/NOT/BE/USED/CONTACT/ROOTSIGN/AT/ICANN/DOT/ORG/FOR/MOR E/INFORMATION+++++++++++++++++++++++++++++++++++++++++++ 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++8=

;; Query time: 119 msec
;; SERVER: 199.7.83.42#53(199.7.83.42)
;; WHEN: Thu Jan 28 08:43:00 2010
;; MSG SIZE  rcvd: 439

Jan 27

rdup 1.1.0

Posted in rdup, comments: 0

Maybe I'm marketing this to death, but I've released rdup version 1.1.0 a couple of days ago.

It should rock! :-) Further details can be found on the temporary project page.


Jan 21

Go introductie

Posted in dutch, comments: 0

Go is een splinter nieuwe taal van Google die (naar ik hoop) groot belooft te worden. Ik heb al wat programmaatjes hierover geschreven, maar om de taal beter te leren kennen heb ik de Go tutorial vertaald naar het Nederlands. Binnenkort verschijnt er ook een blog item bij AT Computing over Go.

Dit is nog lang niet af, maar het begin is er. Er moet nog

  • eens goed doorgelezen worden;
  • beter lopend verhaal van worden gemaakt;
  • spelling controle is ook geen overbodig luxe;
  • vergeleken worden met de laatste Engelse versie.

Heb je zin om te helpen, laat het gewoon even weten, als het allemaal teveel wordt open ik wel een account op github.

Dit natuurlijk allemaal onder het mom van; release early, release often. :-)


Jan 21

Go tutorial in Dutch

Posted in go, comments: 1

During the last few weeks I've attempted to translate the Go tutorial to Dutch. This was a lot more work than anticipated and I'm still not finished, but I just wanted to share what I've got up to now.

You can get the text version here.

Things do

  • Finish translating the last few paragraphs;
  • Proof read;
  • Spell check;
  • Update it to the latest Go release;
  • Get this included in Go?

Jan 18

RELEASE NOTES for RDUP 1.1.0

Posted in rdup, comments: 1

These are the release notes for the soon to be released rdup 1.1.0.

This is the first release of the new rdup branch, version 1.1.0.

Why this new branch?

I (and because of user requests) wanted to implement some extra features which needed (extensive) code modifications. I did not want to mess with the current stable release, hence a 1.1.x branch. However 1.1.x will obsolete 1.0.x soonish.

What is the difference with 1.0.x? (aka new features)

  1. there is now only one default output format which always includes the files' contents;
  2. the rdup output is now more comparable with the tar archive format, with the big difference of being able to delete files.
  3. the new output includes: user- and groupnames and the modification timestamp of the file. They can now be correctly set on remote systems. (I.e the uid 'bert' stays 'bert' even if the remote side using a different uid numbers for 'bert');
  4. more efficient, files are only read once. In rdup 1.0.x both rdup and rdup-tr read files, in 1.1.x only rdup reads files.

With this change the following new features were added

  • rdup now has a -a switch: restore a-time when reading files;
  • rdup-up now sets the m-time on files it creates, this is the default;
  • rdup-up sets the user- and groupname more correct, see point 3. above;
  • rdup-tr can now be run on remote systems, because it receives the files' content on standard input.

This work led to the following changes

  • rdup has gotten the -P flag from rdup-up. This also makes the -a flag work even if you pipe the files' through external programs: they are only read once from disk;
  • rdup-tr only processes from stdin to stdout;
  • rdup-up only processes stdin;
  • much more tests are added to the test suite (make check);
  • code cleanups.

Some future work will of course remain, but I'm happy with how things turned out. A proper release will happen this week.

Those interested may check out the latest git code and play with that.


Jan 09

ClueBat

Posted in dutch, comments: 12

Ken je het gevoel: Je bent in een (technisch) gesprek met iemand en je denkt halverwege het gesprek: "Volgens mij heeft hij/zij er geen ene moer van begrepen". Had ik maar iets om het goed uit te kunnen leggen.... Daarom nu

De ClueBat!

Met deze honkbal knuppel van kennis zul je nooit meer problemen hebben om bijvoorbeeld iemand de geheimen van het SMTP protocol uit te leggen:

PTMS bat

Of wanneer de letters in diegene z'n voorhoofd staan:

SMTP bat

Ik heb nog 3 knuppels over. Eentje voor DNS (zijn gelukkig maar 3 letters). Nog suggesties voor de laatste 2?

Cluebat creatie

Met maken van zo'n bat is wel een rot werkje en ik moet me er nog meer in bekwamen, maar met een Dremel (van de buurman) kom je een heel eind:

Maken van de knuppel

Maken van de knuppel

Maken van de knuppel