\documentstyle[cascade]{article}

%Choose one of the following margin settings depending on what size paper
%you will be printing on; they are selected to approximately centre the
%output on the printed page. Textwidth is very large, since charts with
%many generations will otherwise generate many overfull \hbox messages.
%Textheight is also larger than the default since it is recognised that
%many descendants charts are likely to be exchanged by airmail with
%relatives in distant lands.

\topmargin 27pt \oddsidemargin -40pt \evensidemargin -40pt
% for A4 size

%\topmargin 2pt \oddsidemargin -32pt \evensidemargin -32pt
% for 8.5in\tiems 11in size

\textheight 584pt
\textwidth 530pt

%A new environment (paftab) is defined based on LateX's tabbing environment.
%The original tabbing environment was unsuitable since it frequently led
%to capacity exceeded messages. Apart from stripping unnecessary features
%of the tabbing environment, the main innovation is to insert \global
%commands in front of \setbox and \unhbox commands to reduce the demands
%on stack space. If this has any untoward side effects elsewhere in a TeX
%file, please report to the author.

%Each generation is indented by an amount equal to the width of `mm'.
%This length may be varied at will by replacing the `mm' below with
%any other text.

\newlength{\pafl}
\settowidth{\pafl}{mm}
\newlength{\pafwidth}
\setlength{\pafwidth}{\textwidth}
\addtolength{\pafwidth}{-15pt}
%\newlength{\pafmar}
\newlength{\paftemp}
\newsavebox{\pcurline}
\newsavebox{\pcurfield}

%The count curgen keeps track of the current generation.

\newcounter{curgen}

%\> and \\ are the same as in tabbing
%the command \getmargin is defined in CASCADE.STY along with the page style

\newenvironment{paftab}{\begin{minipage}{\pafwidth}
%	\getmargin{\pafmar}
	\let\>=\prtab
	\let\\=\ptabcr
    \pstartline\ignorespaces}{\pstopfield
	\end{minipage}\newpage}

\newcommand{\pstartline}{\setcounter{curgen}{0}\global\setbox\pcurline\hbox{}
	\pstartfield\strut}

\newcommand{\pstartfield}{\global\setbox\pcurfield\hbox\bgroup}

\newcommand{\prtab}{\pstopfield
	{\paddfield
	\addtocounter{curgen}{1}
	\setlength{\paftemp}{\value{curgen}\pafl}
	\addtolength{\paftemp}{-\wd\pcurline}
    \global\setbox\pcurline\hbox{\unhbox\pcurline\hskip\paftemp}}
    \pstartfield\ignorespaces}

\let\pstopfield=}

\newcommand{\paddfield}{\global\setbox\pcurline\hbox{\unhbox
     \pcurline\unhbox\pcurfield}}

\newcommand{\ptabcr}{\pstopline\pstartline\ignorespaces}

\newcommand{\pstopline}{\unskip\pstopfield\paddfield
   \hbox{%\hskip\pafmar
   \box\pcurline}}

%Another new environment wraps a number of paftab environments to produce a
%single descendants chart:

\newenvironment{chart}[3]{\setcounter{page}{1}
						  %\setcounter{footnote}{0}
						  \setcounter{chart}{#1}
						  \renewcommand{\rootname}{#2}
						  \renewcommand{\rootrin}{#3}}{}

\newcounter{chart}
\newcommand{\rootname}{undefined}
\newcommand{\rootrin}{undefined}
\pagestyle{cascade}
\begin{document}

\input{temp}

\end{document}
\bye
