Drawing a family tree in LaTeX using TikZ

I defined a LaTeX environment tikzfamilytree that facilitates drawing a family tree with TikZ. Here is a small working example (in XeLaTeX). The code provides further documentation. Note that the way people’s names and partnerships are displayed is controlled by commands that fall outside the environment definition. For instance, in my example I use colored Webdings symbols to indicate gender.

Using the uncovering method I described earlier, you can also draw a family tree in a Beamer document and uncover it piecewise. This requires no alterations to the tikzfamilytree environment, but just some customization of the aforementioned displaying commands. The same example looks like this in Beamer (XeLaTeX source):


LaTeX and Beamer: uncovering a tree node by node

Sometimes in Beamer, you want to reveal a tree node for node. With Beamer’s overlay commands, this is no problem (except that overlay commands must be placed within an additional set of curly braces, since Beamer eats them like Skittles). However, hiding and revealing the edges in between is a bit more fiddly. Here I present one way to go about it. The code, which is pretty much self-explanatory, is shown below and when inserted into a Beamer presentation (with the Berlin theme and transparent covering), produces the following output:


% a wrapper to use \onslide within nodes,
% with the necessary extra surrounding accolades
% a command to reveal either show or hide the edge from parent,
% based on the slide number
	edge from parent%
	\frametitle{Uncovering a tree (in an arbitrary order)}
			\node {\revealtext{A}}
					node {\revealtext[2-]{B}}
						node {\revealtext[3-]{C}}
						node {\revealtext[5-]{E}}
					node {\revealtext[4-]{D}}

XeLaTeX and PDF color change

You may have noticed that sometimes when you create a PDF with XeLaTeX, the colors of your graphics look different when you open the PDF in Adobe Reader. What you see is graphics that were originally in the RGB color model, being displayed as if they were in CMYK instead. The reason for this is a bug (or feature?) in Adobe Reader that causes it to default to the CMYK color model when it encounters graphics with transparency, unless the PDF tells it explicitly to display the graphics in RGB.

I found the following fix for this unwanted color conversion here, which carries out a textual replacement in the PDF file to declare the color scheme as RGB  on every page:

# Acrobat Reader shows transpant stuff in CMYK
# You have to tell it to render things in RGB
# for pdflatex
# put this in the preamble of your document:
#\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
# for xelatex
# run this script on the pdf output
sed -i 's/^\/Type\/Page$/\/Type\/Page\n\/Group \<\< \/S \/Transparency \/I true \/CS \/DeviceRGB\>\>\n\/Trans \<\< \/S \/R \>\>\n/' $1

This is an easy fix under Linux, where sed is readily available, but can be cumbersome for Windows users who are not too familiar with a command line interface or regular expressions. Therefore I made a small (CLI) program that carries out this replacement, which can also be invoked by simply dragging and dropping a PDF onto the executable. It is open source and freely available at SourceForge.

I found another fix in a StackExchange thread. With this fix, you declare an RGB color scheme in your XeLaTeX file by including the following code snippet:

\special{pdf: put @thispage <</Group << /S /Transparency /I true /CS /DeviceRGB>> >>}%

A disadvantage to this fix, however, is that this code only applies to the current page. Table 2 of dvipdfm‘s documentation does not suggest a quick solution for this. Perhaps addressing pages by their page number (for which the aforementioned table lists a variable @pagen) and then constructing a loop at the end of the document could work, but I was not able to access any such variable.

TilePic reader

Already some years ago, I made some applications to extract images from a TilePic file (TilePic reader) and to download images from a TilePic web interface (TilePic stitcher).

What a TilePic file is (*.tpc, *.tjp, *.tpg, *.ttx), was once explained on the currently missing homepage of TilePic’s authors:

“TilePic is a file format developed by the Berkeley Digital Library Project that is designed to store tiled data of arbitrary type in a hierarchical, indexed format in order to provide fast retrieval. This format was influenced by the Kodak FlashPix format and is based in part on the GridPix format developed by the Tertiary Disk Project at UC Berkeley.”

The reason that I made these programs, was that this format was used by many sites of Dutch regional archives for their large and detailed scans of original documents. As they often did not provide functionality to download the entire image at its highest resolution, I decided to find a way to do that myself, by stitching the image together from its highest resolution tiles.

TilePic stitcher 2.4 GUI screenshot

The applications are open source and available at SourceForge, where the project’s website offers more information and additional screenshots.

Proto-Indo-European hangman

A couple of years ago I implemented the game Hangman for Proto-Indo-European. It was really just for laughs and giggles after it had turned into a sort of tradition to play the game in real life with fellow students, during the breaks of courses in comparative Indo-European linguistics at Leiden University.

Actually the game above is only a small instantiation of the game I made: it only contains 18 words, reconstructed by R.S.P. Beekes. The Flash file, despite its laughably childish graphics, can be called with parameters that contain the display alphabet, transcription alphabet, and vocabulary list. For more information on these parameters, check the source code of this page. Other small instantiations of the same game for Ancient Greek and Gothic can be found through the menu.

Gothic hangman

Greek hangman

Verifying multi-party authentication protocols

For my MSc thesis at Eindhoven University of Technology, I did some work on the verification of multi-party authentication protocols, using rank functions and the theorem prover PVS. This eventually resulted in a published paper .


Accompanying PVS code

theory PVS version description
csp_rules 4.1/4.2
Neil Evans’ framework for modelling CSP and Schneider’s Rank Theorem, updated from PVS version 3.1 and slightly extended
nsl* 4.1/4.2
Analysis of the Needham-Schroeder-Lowe public key protocol using rank functions
gnsl* 4.1/4.2
Analysis of Cremers and Mauw’s Generalised Needham-Schroeder-Lowe public key protocol, using rank functions

*Requires the csp_rules theory as a library, for which the appropriate path must be set in the file dynetwork.pvs.

Running the gnsl theory

  • Initial set up
    1. Install PVS
    2. Download and uncompress the appropriate versions of the gnsl and csp_rules theories (making sure to adjust the path to the latter in the file dynetwork.pvs)
  • Opening the theory
    1. Start PVS (this opens Emacs)
    2. Change the current context to the folder containing the gnsl with the command M‑x change‑context
    3. Open the file gnsl.pvs
  • Working with the theory
    1. Perform any command on opened file (get PVS help with the command C‑x h)
      • for proving the theory and its importchain, use the command M‑x pri
      • for stepping through a proof, move the cursor onto a lemma and use the command M‑x step-proof (stepping through it with TAB 1 or ESC n TAB 1 for n steps)