| 1 |
% \iffalse |
| 2 |
% Copyright 2022 Jiro Senju |
| 3 |
% |
| 4 |
% This package is free software; you can redistribute it and/or modify |
| 5 |
% it under the terms of the GNU General Public License as published by |
| 6 |
% the Free Software Foundation; either version 2 of the License, or |
| 7 |
% any later version. |
| 8 |
% |
| 9 |
% This package is distributed in the hope that it will be useful, |
| 10 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
% GNU General Public License for more details. |
| 13 |
% |
| 14 |
% You should have received a copy of the GNU General Public License |
| 15 |
% along with this package. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
% |
| 17 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 18 |
%<package>\ProvidesPackage{familytree}% |
| 19 |
%<package>[2022/06/27 v3.1 familytree] |
| 20 |
% |
| 21 |
%<*driver> |
| 22 |
\documentclass[draft]{ltxdoc} |
| 23 |
\let\Ocmd=\cmd |
| 24 |
\renewcommand{\cmd}[1]{% |
| 25 |
%\hskip-\parindent |
| 26 |
\parbox{.95\textwidth}{\Ocmd{#1}}% |
| 27 |
} |
| 28 |
% |
| 29 |
\input{fonts} |
| 30 |
% |
| 31 |
\usepackage[dvipdfmx,final]{graphicx} |
| 32 |
\usepackage[final]{listings} |
| 33 |
\lstset{basicstyle=\small\ttfamily, |
| 34 |
language=TeX, |
| 35 |
columns=[c]flexible, |
| 36 |
tabsize=4, |
| 37 |
%frame=tb, |
| 38 |
keepspaces=true, |
| 39 |
%lineskip=-.1em, |
| 40 |
belowskip=\medskipamount} |
| 41 |
\usepackage{multicol} |
| 42 |
\usepackage{needspace} |
| 43 |
% |
| 44 |
% hyperref should come last |
| 45 |
\usepackage[dvipdfmx,final,pdfusetitle]{hyperref} |
| 46 |
% bookmarksdepth=section |
| 47 |
% pdffitwindow=true |
| 48 |
% pdfpagetransition=Dissolve |
| 49 |
% pdfstartview=FitB |
| 50 |
\hypersetup{ |
| 51 |
hyperfootnotes=false, |
| 52 |
colorlinks=true, |
| 53 |
linkcolor=blue, |
| 54 |
% anchorcolor=black, |
| 55 |
% citecolor=black, |
| 56 |
% urlcolor=black, |
| 57 |
bookmarks=true, |
| 58 |
bookmarksnumbered=true, |
| 59 |
setpagesize=false, |
| 60 |
%pdftitle={}, |
| 61 |
%pdfauthor={}, |
| 62 |
pdfpagelayout=SinglePage, |
| 63 |
pdfpagemode=UseOutlines, |
| 64 |
pdfstartview=FitH |
| 65 |
} |
| 66 |
% |
| 67 |
\usepackage{\jobname} |
| 68 |
% |
| 69 |
\makeatletter |
| 70 |
\def\meta@font@select{\slshape} |
| 71 |
\def\fps@table{htbp} |
| 72 |
\let\part=\@gobble |
| 73 |
% |
| 74 |
\newcount\ft@lastsection |
| 75 |
\newcommand{\subsectImpl}[1][\subsection]{% |
| 76 |
\iftrue% debugging code |
| 77 |
\@tempcnta=\numexpr\thesection + 1\relax% |
| 78 |
\ifnum\@tempcnta>\ft@lastsection\else% |
| 79 |
Jump to \hyperlink{section.\the\@tempcnta}{next section}% |
| 80 |
\fi% |
| 81 |
\fi% |
| 82 |
\needspace{4\baselineskip}% |
| 83 |
#1{Implementation}% |
| 84 |
} |
| 85 |
\makeatother |
| 86 |
% |
| 87 |
\newcommand{\parag}[1]{% |
| 88 |
\allowbreak% |
| 89 |
\paragraph{#1}\nopagebreak\hskip0pt\nopagebreak% |
| 90 |
%\medskip% |
| 91 |
} |
| 92 |
\newcounter{CS}[section] |
| 93 |
\newcommand{\CS}{% |
| 94 |
\ifnum\theCS=0% |
| 95 |
control sequence% |
| 96 |
\stepcounter{CS}% |
| 97 |
\else% |
| 98 |
CS% |
| 99 |
\fi% |
| 100 |
} |
| 101 |
\newcommand{\srcfig}[2][]{% |
| 102 |
\lstinputlisting{\Dir/#2print}% |
| 103 |
\nopagebreak[4]% |
| 104 |
\hfil\includegraphics[#1]{\Dir/#2.pdf}% |
| 105 |
} |
| 106 |
\newcommand{\NoDescription}{\vspace*{-.9\baselineskip}} |
| 107 |
\newcommand{\IhadtoSplit}{% |
| 108 |
This is not a good structure since it bogusly splits a long code into |
| 109 |
a few parts, and may global variables. Comparing to the non-split |
| 110 |
version, the split one is just a little better. |
| 111 |
} |
| 112 |
\let\tableautorefname=\tablename% |
| 113 |
\renewcommand{\subsectionautorefname}{} |
| 114 |
\newcommand{\refnm}[1]{% |
| 115 |
\autoref{#1} ``\nameref{#1}''% |
| 116 |
} |
| 117 |
% |
| 118 |
% \EnableCrossrefs |
| 119 |
\DisableCrossrefs |
| 120 |
% \PageIndex |
| 121 |
%\CodelineIndex |
| 122 |
\makeatletter |
| 123 |
\let\theCodelineNo=\reset@font |
| 124 |
\AtEndDocument{% |
| 125 |
\immediate\write\@auxout{% |
| 126 |
\string\global\string\ft@lastsection=\thesection% |
| 127 |
}% |
| 128 |
} |
| 129 |
\makeatother |
| 130 |
%\RecordChanges |
| 131 |
% |
| 132 |
\begin{document} |
| 133 |
\MakeShortVerb{\|} |
| 134 |
\let\PrintIndexO=\PrintIndex |
| 135 |
\let\PrintIndex=\relax |
| 136 |
\DocInput{\jobname.dtx} |
| 137 |
\DocInclude{ft-individual} |
| 138 |
\DocInclude{ft-sibling} |
| 139 |
\DocInclude{ft-gens} |
| 140 |
\DocInclude{ft-marriage} |
| 141 |
\DocInclude{ft-lib} |
| 142 |
%\PrintChanges |
| 143 |
% \PrintIndexO |
| 144 |
\end{document} |
| 145 |
%</driver> |
| 146 |
% \fi |
| 147 |
% |
| 148 |
% \GetFileInfo{\jobname.sty} |
| 149 |
% \title{{\spaceskip=1ex\textsf{\jobname} package \fileversion}} |
| 150 |
% \author{Jiro Senju\\\texttt{\small jiro1010senju AT gmail DOT com}} |
| 151 |
% \date{\filedate} |
| 152 |
% \maketitle |
| 153 |
% |
| 154 |
% Draws a Family Tree. |
| 155 |
% |
| 156 |
% Defines a box describing an individual, and connects the multiple |
| 157 |
% boxes by lines. |
| 158 |
% The line represents the sibling, the parent-child relation ship, or |
| 159 |
% the marriage. |
| 160 |
% |
| 161 |
% \begin{itemize} |
| 162 |
% \item Excluding the marriage box, you can get a maleline\slash patrilineal |
| 163 |
% tree, or a femaleline\slash matrilineal tree. |
| 164 |
% \item For Japanese, |jlreq.cls| vertical option (|tate|) is supported. |
| 165 |
% \end{itemize} |
| 166 |
% \bigskip |
| 167 |
% |
| 168 |
% \setcounter{tocdepth}{2} |
| 169 |
% \columnseprule=\arrayrulewidth |
| 170 |
% \begin{multicols}{2} |
| 171 |
% \tableofcontents |
| 172 |
% \end{multicols} |
| 173 |
% \bigskip |
| 174 |
% |
| 175 |
% \setcounter{secnumdepth}{0} |
| 176 |
% \section{Introduction} |
| 177 |
% |
| 178 |
% Family Tree is interesting. |
| 179 |
% But also, it can be really complicated, especially including the |
| 180 |
% siblings and marriages. |
| 181 |
% |
| 182 |
% Graphviz (|dot(1)|) is a good tool to draw a family tree, but I want |
| 183 |
% more straightforward understandability. |
| 184 |
% Here I try developing some macros to draw a family tree easily. |
| 185 |
% I am not a TeXnician, but I hope it helps someone who wants to draw |
| 186 |
% and view a large family tree. |
| 187 |
% Tested on TeX Live 2019. |
| 188 |
% Any comments will be appreciated. |
| 189 |
% |
| 190 |
% \subsection{Development} |
| 191 |
% |
| 192 |
% Basically all \CS s have a prefix ``|ft|''. |
| 193 |
% But non-prefix names are also defined by |\let| as an alias\slash |
| 194 |
% synonym, to improve the usability and the visibility. |
| 195 |
% Obviously only when the name is undefined. |
| 196 |
% If \CS{} name is already defined and |familytree| pkg cannot define the alias, |
| 197 |
% |\message| is generated. |
| 198 |
% This document tries using the |ft|-less alias name, but a few are used |
| 199 |
% with the prefixed name. |
| 200 |
% \smallskip |
| 201 |
% |
| 202 |
% There are multiple |dtx| files, but the generated |sty| is only one. |
| 203 |
% |ft-lib.dtx| is described at last of this document, but it comes |
| 204 |
% first in |sty|. |
| 205 |
% \medskip |
| 206 |
% |
| 207 |
% In the beginning, I was going to implement using |\hbox| and |\vbox| |
| 208 |
% or |tabular| environment. I thought they would be enough. |
| 209 |
% After defining the boxes, I would connect them by lines, then I got a |
| 210 |
% trouble. |
| 211 |
% |latex| adjusts the position of the boxes by inserting a glue or |
| 212 |
% something, and their connection points are shifted. I could not find a |
| 213 |
% good universal solution. |
| 214 |
% Can TikZ or something define the absolute coordinates and the lines? I |
| 215 |
% don't know. |
| 216 |
% To connect the lines, I had to choose |picture| environment. |
| 217 |
% |
| 218 |
% The depth of a character was another trouble, or I don't have enough |
| 219 |
% experience and |
| 220 |
% knowledge. To layout the boxes in |picture|, I have to consider the |
| 221 |
% depth of the box. |
| 222 |
% To support the Japanese in vertical mode, the depth is very important. In |
| 223 |
% horizontal mode, the depth is very alike of the English alphabets. But |
| 224 |
% in vertical mode, the depth is a half size of a character. |
| 225 |
% I didn't know that, and it took very long time for me. |
| 226 |
% |
| 227 |
% \subsection{Structure} |
| 228 |
% |
| 229 |
% Defines every element as a box in the tree, and connects them by lines. |
| 230 |
% In defining a box, we also define its connection points which make the |
| 231 |
% box to be connectable later. |
| 232 |
% |
| 233 |
% These are the elements. |
| 234 |
% |
| 235 |
% \begin{enumerate} |
| 236 |
% \item individual box |
| 237 |
% \begin{itemize} |
| 238 |
% \item child mark to represent one is adopted or biological child |
| 239 |
% \item one's title |
| 240 |
% \item one's name |
| 241 |
% \item maleline\slash femaleline for the patrilineal\slash matrilineal tree |
| 242 |
% \item additional information\par |
| 243 |
% birth\slash death year-month-date, nickname, or anything |
| 244 |
% \end{itemize} |
| 245 |
% |
| 246 |
% \item sibling box |
| 247 |
% \begin{itemize} |
| 248 |
% \item a line between the child marks |
| 249 |
% \item interval box to make a space between individuals |
| 250 |
% \end{itemize} |
| 251 |
% |
| 252 |
% \item marriage box |
| 253 |
% \begin{itemize} |
| 254 |
% \item marriage line (double line) to connect the husband and the wife |
| 255 |
% \end{itemize} |
| 256 |
% |
| 257 |
% \item parent-child relationship or generations box |
| 258 |
% \end{enumerate} |
| 259 |
% |
| 260 |
% \setcounter{secnumdepth}{3} |