排版家譜樹

排版家譜樹

我正在尋找一種在 LaTeX 中排版家譜樹的簡單方法。

我特別感興趣的是排版一個所謂的“Ahnentafel”,這是一棵樹,顯示我、我的父母、我的祖父母、我的曾祖父母等。每個級別的分支機構數量都會增加一倍。

有一個包包可以幫助我嗎?可悲的是,http://www.ctan.org/topic/genealogy是空的。

我注意到一些推薦 TikZ 來繪製樹木的帖子。我從未使用過 TikZ,也不願意僅僅為了這個目的而深入研究它。但如果我必須這樣做,我就必須這樣做。

編輯:

這是我想要創建的範例:

這是第三代 Ahnentafel。

這是第三代Ahnentafel

答案1

這是另一個使用的選項forest說明其其他一些功能:

\documentclass{standalone}
\usepackage{tabularx}
\usepackage{forest}
\usetikzlibrary{shapes.geometric}

% comment out the following four lines if the Helvet Neue font are not available:
\usepackage{fontspec}
\newfontfamily\namefont[]{Helvetica Neue Condensed Bold}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Helvetica Neue Light}

\definecolor{color1}{HTML}{FFCB73}
\definecolor{color2}{HTML}{FFA100}

\newcommand\Person[5]{%
  {\namefont #1} \\
  \begin{tabularx}{4.5cm}[t]{@{}r@{\hspace*{2pt}}X@{}}
  b: & #2 \\
  & #3 \\
  d: & #4 \\
  & #5
  \end{tabularx}%
}

\begin{document}

\begin{forest}
delay={
  for tree={
    edge path={
      \noexpand\path[\forestoption{edge}]
        ([xshift=-(6pt-1pt*level)].child anchor) to[out=180,in=0]
        ([xshift=(6pt-1pt*level)]!u.parent anchor)\forestoption{edge label};
    },
    if n=1
      {fill=color1,shape=tape,tape bend bottom=none}
      {if n'=1
        {fill=color2,shape=tape,tape bend top=none}
        {}
      }
  }
},
for tree={
  line width=3pt,
  inner sep=8pt,
  draw=brown,
  minimum size=1cm,
  text width=4.5cm,
  child anchor=west,
  parent anchor=east,
  grow=east,
  l sep=2cm,
  s sep=10pt,
  draw,
  anchor=west,
  edge={line width=(18pt-3pt*level),line cap=rect,color=brown},
}
[\Person{Abraham /LINCOLN/}{12 Feb 1809}{Hardin (Larue), KY}{15 Apr 1865}{Washington, DC},fill=color2
  [\Person{Nancy /HANKS/}{5 Feb 1784}{Campbell Co., Virginia}{5 Oct 1818}{Centryville, Spencer, Ind}
   [\Person{Nancy /SHIPLEY/}{ABT 1745}{Pembroke, Wash, ME}{}{Amelia, Amelia, VA}
     [\Person{Sarah Or Rachel}{ABT 1723}{}{}{}
     ]
     [\Person{Robert /SHIPLEY/}{ABT 1719}{}{}{}
     ]
   ]
   [\Person{Joseph /HANKS/}{ABT 1740}{Pembroke, Wash, ME}{}{Amelia, Amelia, VA}
     [\Person{Sarah /EVANS/}{ABT 1714}{Pembroke, Wash, ME}{}{}
     ]
     [\Person{John /HANKS/}{22 Oct 1709}{Pembroke, Wash, ME}{6 Sep 1742}{Pembroke, Wash, ME}
     ]
   ]
  ]
  [\Person{Thomas /LINCOLN/}{20 Jan 1780}{Rockingham, VA}{17 Jan 1851}{Beechland, Co., KY.}
    [\Person{Bethsheba /HERRING/}{1746}{Rockingham, Co., VA.}{}{}
      []
      []
    ]
    [\Person{Abraham /LINCOLN/}{17 May 1744}{Berks, Co., Penn.}{1786}{Jefferson County, KY}
      [\Person{Rebecca /FLOWERS/}{30 Mar 1720}{Berks, Co., Penn.}{1806}{Berks, Co., Penn}
      ]
      [\Person{John /LINCOLN/}{3 May 1711}{Freehold, Monmouth, N.J.}{1778}{PA}
      ]
    ]
  ]
]
\end{forest}

\end{document}

結果:

在此輸入影像描述

在這個解決方案中,邊緣是彎曲的,以暗示一棵樹,並且樹枝的厚度隨著等級的增加而自動減小;此外,透過為其節點選擇不同的屬性(形狀、填充)來區分男性和女性;所有這些都是在樹規範中完成的。

我的範例中使用的字體Helvet Neue可以從以下位置下載rebba pocket

答案2

新發布的家譜樹包可以幫助你!這篇文章前面提到了 0.10 alpha 版本,我必須手動安裝當前版本,因為目前的 Latex 發行版被凍結,直到新的升級。

目前可以使用該套件執行哪些操作的範例:http://mirrors.ctan.org/macros/latex/contrib/genealogytree/genealogytree-example-2.pdf 例子2

我無法從這張圖片中添加 MWE,因為我無法自己解析它。

您可以在這裡找到該包:http://www.ctan.org/pkg/genealogytree

來自 Genealogytree 軟體包 0.90 版本手冊 (2015/05/22):

譜系和家譜樹圖是經過驗證的工具,可以視覺化個體之間的遺傳和關係連結。具有父節點和子節點的數學樹結構的命名是根據歷史家族圖來命名的。然而,即使是由兩個父母和幾個孩子組成的最小家庭實體也不是數學樹,而是更一般的圖。 Genealogytree 套件提供了一組工具來排版此類譜系樹,或者更準確地說,排版一組用於描述家族結構的特殊圖表。該軟體包使用自動佈局演算法,可以對其進行定制,例如對某些路徑進行優先排序。

答案3

您可以使用forest我最近學習的樹狀圖。這段程式碼幾乎歸功於貢薩洛·梅迪納的回答關於我forest以這種方式使用的問題:

\documentclass[tikz,12pt]{standalone}
\usetikzlibrary{calc,positioning,backgrounds,arrows.meta}
\usepackage{forest}
\pagestyle{empty}

\begin{document}

\begin{forest}
  for tree={
    child anchor=west,
    parent anchor=east,
    grow=east,
    draw,
    anchor=west,
    edge path={
      \noexpand\path[\forestoption{edge}]
        (.child anchor) -| +(-5pt,0) -- +(-5pt,0) |-
        (!u.parent anchor)\forestoption{edge label};
    },
  }
  [Me
    [My Father
      [My Father's Father
      ]
      [My Father's Mother
      ]
    ]
    [My Mother
      [My Mother's Father
      ]
      [My Mother's Mother
      ]
    ]
  ]
\end{forest}

\end{document}

家庭森林

答案4

在此輸入影像描述

另一種間接解決方案。幾年前,我使用了一個名為 LifeLines 的程式http://lifelines.sourceforge.net它讀取 GEDCOM(嘗試谷歌搜尋)文件,並可以產生 LaTeX 格式(以及其他格式)的各種報告和樹。

編輯上面我加入了幾頁 LaTeX 輸出的掃描。

相關內容