# 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 small LaTeX package overview

I have made an overview (PDF) of some of the LaTeX packages I use most, with accompanying small examples. The overview also includes some packages that are particularly useful to linguists.

# 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:

#!/bin/sh # 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 outputsed -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:

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

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.