如何在 LaTeX 中绘制语言家族树

如何在 LaTeX 中绘制语言家族树

我一直试图将这个语言家族树绘制到 LaTeX 中: 我尝试过使用该tikz包以及该forest包,但无济于事。我不需要树中的颜色,也不需要以相同的方式格式化行,而只是让行转到正确的语言。

这是我现在拥有的代码(我没有包含“波罗的海”分支,因为它不是绝对必要的):

\documentclass[a4paper, 11pt]{book}
\usepackage{lipsum} %This package just generates Lorem Ipsum filler text. 
\usepackage{fullpage} % changes the margin
\usepackage{forest}
\usepackage{showframe} % just to show the margin lines; comment this package     out for the final version

\begin{document}

\section*{Language tree}

\begin{forest}
for tree={
    edge path={
        \noexpand\path [thick, \forestoption{edge}] (!u.parent anchor) --   +(0,-7pt) -| (.child anchor)\forestoption{edge label};
}, % this option together with setting the parent and child anchors to south and north, respectively, gives you the right-angle style for your branches
parent anchor=south,
child anchor=north,
align=center, % allows you to put line breaks within nodes
}
 [Indo-European
[Balto-Slavic
    [Slavic
        [West
            [Old West Slavic
                [Minovian
                    [Old Minovian
                        [Minovian]
                [Lechitic
                    [Old Polish
                        [Polish]
                        [Silesian]
                    [Polabian
                    [Pomeranian
                        [Kashubian]
                [Czech-Slovak
                    [Czech]
                    [Slovak]
                [Knaanic
                [Sorbian
        [South
            [Western
                    [Slovene]
                [Serbo-Croatian
                    [Bosnian]
                    [Croatian]
                    [Serbian]
            [Eastern
                [Old Church Slavonic
                        [Bulgarian]
                        [Church Slavonic]
                        [Macedonian]
        [East
                        [Old Novgorod]
                [Old East Slavic
                        [Old Ruthenian]
                        [Belarusian]
                        [Russian]
                        [Rusyn]
                        [Ukranian]
                    ]
                ]
            ]
        ]
    ]
]  
]
\end{forest}

\end{document}

这些是我收到的错误:

在 LaTeX 中可以做到这一点吗?

(我正在使用 XeLaTeX 编译器)

提前感谢您的帮助。


根据原帖的要求,我粘贴了一个可以编译的版本。我已经开始改写右括号,]但还没有完成。-marmot

\documentclass[a4paper, 11pt]{book}
\usepackage{lipsum} %This package just generates Lorem Ipsum filler text. 
\usepackage{fullpage} % changes the margin
\usepackage{forest}
\usepackage{showframe} % just to show the margin lines; comment this package     out for the final version

\begin{document}

\section*{Language tree}

\begin{forest}
for tree={
    edge path={
        \noexpand\path [thick, \forestoption{edge}] (!u.parent anchor) --   +(0,-7pt) -| (.child anchor)\forestoption{edge label};
}, % this option together with setting the parent and child anchors to south and north, respectively, gives you the right-angle style for your branches
parent anchor=south,
child anchor=north,
align=center, % allows you to put line breaks within nodes
%grow'=south
}
[Indo-European
[Balto-Slavic
    [Slavic
        [West
            [Old West Slavic
                [Minovian
                    [Old Minovian
                        [Minovian]
                    ]
                ]                           
                [Lechitic
                    [Old Polish
                        [Polish
                        [Silesian]
                        ]
                        [Polabian
                        [Pomeranian
                        [Kashubian]
                        ]
                        ]   
                    ]       
                [Czech-Slovak
                    [Czech]
                    [Slovak]
                    ]
                [Knaanic]
                [Sorbian]
        [South
            [Western
                    [Slovene]
                [Serbo-Croatian
                    [Bosnian]
                    [Croatian]
                    [Serbian]
            [Eastern
                [Old Church Slavonic
                        [Bulgarian]
                        [Church Slavonic]
                        [Macedonian]
        [East
                        [Old Novgorod]
                [Old East Slavic
                        [Old Ruthenian]
                        [Belarusian]
                        [Russian]
                        [Rusyn]
                        [Ukranian]
                    ]
                ]
            ]
        ]
    ]
]  
]]]]]]]
\end{forest}
\end{document}

答案1

这是另一个版本:

\documentclass[landscape]{article}
\usepackage[margin=1in]{geometry}
\usepackage{textcase}
\usepackage[edges]{forest}
\forestset{list/.style=
               {l sep=2pt,l=0,
                for descendants={no edge,l sep=2pt,l=0}},
    lfamily/.style={content=\MakeTextUppercase{##1}},
    dead/.style={fill={red!50}},
    living/.style={fill={green!50}}
}
\begin{document}
\begin{forest}forked edges,for tree={draw,align=center,minimum width=.8in,inner sep=1pt,font=\sffamily}
[Indo-European,lfamily
[Balto-Slavic,lfamily
    [Baltic,lfamily
        [West,lfamily
            [Galindan,list,for tree=dead
            [Prussian
            [Sudovian]]]
        ]
        [East,lfamily
            [Latvian,list,living
            [Lithuanian,living
            [Selonian,for tree=dead
            [Semigallian]]]]
        ]
    ]
    [Slavic,lfamily,l=1.5in
        [West,lfamily,
            [Old West Slavic,dead
                    [Minovian,lfamily
                    [Old Minovian,dead
                        [Minovian,living ]
                    ]
                ]
                [Czech-Slovak,dead
                [Knaanic,list,dead
                [Sorbian,living ]]
                [Czech,list,for tree=living
                [Slovak ]]]
                [Lechitic,lfamily
                    [Old Polish,dead
                        [Polish,list,for tree=living
                        [Silesian]]
                        [Polabian,list,for tree=dead
                        [Pomeranian]]]
                    ]
                ]
            ]
        [South,lfamily
            [Western,lfamily
                [Slovene,living]
                [Serbo-Croatian,for tree=living
                    [Bosnian,list
                    [Croatian
                    [Serbian]]]
                ]
            ]
            [Eastern,lfamily
                [Old Church Slavonic,list,dead
                    [Bulgarian,for tree=living
                    [Church Slavonic
                    [Macedonian ]]]
                ]
            ]   
        ]
        [East,lfamily
            [Old Novgorod,dead]
            [Old East Slavic,dead
                [Old Ruthenian,dead]
                [Belarusian,list,for tree=living
                [Russian
                [Rusyn
                [Ukranian]]]]]
            ]
        ]
    ]
]
]
\end{forest}
\end{document}

在此处输入图片描述

答案2

我正在制作家谱并遇到了这个为此而构建的包 - 也可能在这里起作用。 https://www.ctan.org/tex-archive/macros/latex/contrib/genealogytree

相关内容