Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've a solution to a problem that screams out for improvement. I'm working on a second edition of a family history (mine) that has a great number of descendant charts. I've cobbled together a way of presenting them, but it is an enormous PIA and I can't help but believe there is a better way! Below is a MWE that illustrates the crudeness of the code. I've looked at TikZ, hoping for something pre-rolled, but have found nothing that I was able to modify to a solution. Which is a shame in that I'd like the vertical lines to touch at the obvious intersections as well as having midpoint origins leading to horizontal lines as need be.

%%
%% chart1.tex -- The Original Immigrant
%%
\documentclass[letterpaper,12pt]{article}
\usepackage{soul}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage[sc,osf]{mathpazo}
\newlength{\mysize}
\newcommand{\mycfs}[1]{\setlength{\mysize}{#1pt}%
  \fontsize{\mysize}{1.2\mysize}\selectfont}
\newcommand{\nemo}{\rule{4.5em}{0.4pt}}
\begin{document}
\setul{}{1pt}
\begin{table}[ht]
\caption{``\textbf{The Original Immigrant}''}
\vskip .5in
\mycfs{11}
\begin{sideways}
\begin{tabular}{c c c c c}
\multicolumn{5}{c}{\textbf{Pieter Myers}} \\
\multicolumn{5}{c}{c.1660--c.1725} \\
\multicolumn{5}{c}{\vrule} \\
\multicolumn{5}{c}{David Myers} \\
\multicolumn{5}{c}{c.1690--c.1760} \\
\multicolumn{5}{c}{\vrule} \\
\multicolumn{5}{c}{David Myers} \\
\multicolumn{5}{c}{\ul{c.1730--c.1790}} \\
\multicolumn{5}{c}{\vrule} \\
\cmidrule(l{3.49em}){1-1}\cmidrule(r{4.56em}){2-5} \\
% \cmidrule columns should be {2-N} where N ='s number of 'c's
\addlinespace[-1.5em]
% increase 0em till above \vrule then decrease
% as many \vrules as 'children' with enough white space to fit widest entry after...
\vrule & \vrule & \vrule & \vrule & \vrule \\
Henry Myers & Christian Myers & Samuel Myers & Daniel Myers & \textbf{Abram Myers I} \\
c.1752--c.1778 & c.1754--23 Aug 1799 & c.1755-- & c.1758-- & c.1760--c.1845 \\
& m. Charity \rule{4.5em}{0.4pt} & & & m. Mary C. Schell \\
& c.1755--19 Mar 1812 & & & \ul{1765--c.1855} \\
& & & & \vrule \\
& & & & David Myers \\
& & & & c.1770--1872 \\
& & & & Jonas Myers \\
& & & & 1795--1870 \\
& & & & Abram Myers II \\
& & & & 1795--1870 \\
& & & & Caroline Myers \\
& & & & 1800--1849 \\
& & & & Mary Myers \\
& & & & c.1805-- \\
& & & & John Myers \\
& & & & 1807--c.1879 \\
\end{tabular}
\end{sideways}
\end{table}
\end{document}

Any improvement gratefully accepted. Something I can turn into a style would be tremendous, but any clarity would be good.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

I think TikZ is nevertheless where you want to go, specifically its tree capability. There are a few questions on TeX.sx that deal with famuily trees that will provide you with an indication of what can be done. Please look at Joining two branches of a family tree, How can I improve this family tree in TikZ? and Genogram or family tree with PGF/TikZ. The manual to TikZ-pgf is available at CTAN (or may already be in your LaTeX distribution. Getting started with TikZ-pgf can be a little daunting but there are numerous examples to learn from at this site.

share|improve this answer
    
Thanks for the pointers, I've looked at all of them and they have indeed given me some ideas. I suspect part of the problem is that I'm duplicating the original charts that were done on a typewriter! The irony of having some things be easier in antique tech is humorous in a dark sort of way. Regards the TikZ manual, daunting is a bit of an under statement to my mind. That said I've both the PDF as well as a copy of same on my Kindle. I've even considered a new version with 'epub' as the target, but that is a problem for another day! –  hsmyers Jan 11 '13 at 0:28

Inspired by Peter Jansson's comment, I got off of my dead a** and hit the books. In particular I looked at tikz-qtree. What is shown below is certainly not the best solution, but it is quite a bit better looking than my original and easier to use. Unlike my first attempt, this one handles most of the calculation for me. The only thing that needs to be tinkered with is the level depth and that is certainly easier than before. So here it is:

%%
%% chart.tex -- test bed for descendent charting
%%
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\def\unknown{--------}
\def\circa{$^\approx$}
\begin{document}
\begin{figure}[h!]
\caption{``The Original Immigrant''}
\vspace{1.5em}
\centering
\begin{tikzpicture}
\tikzset{
  married/.style={
    append after command={
      (\tikzlastnode.south west) edge [very thick]
      (\tikzlastnode.south east)
    }
  }
}
\tikzset{execute at begin node=\strut}
\tikzset{level distance = 4em}
\tikzset{level 4/.style={level distance=2em}}
\tikzset{level 5/.style={level distance=6.5em}}
\tikzset{level 6/.style={level distance=5em}}
\tikzset{every tree node/.style={align=center,anchor=north}}
\tikzset{edge from parent/.style={
  draw,
  edge from parent path={
    (\tikzparentnode.south)
    -- +(0,0)
    -| (\tikzchildnode)
    }
  }
}
\Tree 
    [.{Pieter Myers\\\circa 1660---\circa 1725} 
    [.{David Myers\\\circa 1690---\circa 1760} 
    [.{David Myers\\\circa 1730---\circa 1790} 
      [
        [.{Henry Myers\\\circa 1752---\circa 1778} ] 
        [.{Christian Myers\\\circa 1754---23 Aug 1799\\m.Charity \unknown\\\circa 1755---19 Mar 1812} ] 
        [.{Samuel Myers\\\circa 1755---} ] 
        [.{Daniel Myers\\\circa 1758---} ] 
        [.\node[married]{\textbf{Abram Myers I}\\\circa 1760---\circa 1845\\m.Mary C. Schell\\1765---\circa 1855}; 
          [.{\\David Myers\\\circa 1770---1872\\[.5em]
          Jonas Myers\\1795---1870\\[.5em]
          Abram Myers II\\1795---1870\\[.5em]
          Caroline Myers\\1800---1849\\[.5em]
          Mary Myers\\\circa 1805---\\[.5em]
          John Myers\\1807---\circa 1879}
          ]
        ] 
      ] 
    ] 
  ]
] 
\end{tikzpicture}
\end{figure}
\end{document}

At 62 lines, it is slightly longer than the original, but if you consider the interface, the difference in size is inconsequential. I'm still open for improvements so fire away!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.