我是新来的,最近才开始使用 LaTeX。
这就是我想要实现的目标:
注意垂直线和斜线。垂直线代表头部。
这是我能做的:
这是代码:
\documentclass[12pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{tipa}
\usepackage{tikz-qtree}
\begin{tikzpicture}[baseline]
\tikzset{frontier/.style={distance from root=100pt}}
\Tree
[.Pwd [.Ft [.$\sigma$ [.æ ] ] [.$\sigma$ [.l ] [.\textipa{\textschwa} ] ] ] [.Ft [.$\sigma$ [.b ] [. æ ] ] [.$\sigma$ [.m ] [.\textipa{\textschwa} ]] ] ]
\end{tikzpicture}
\end{document}
编辑:我对这个问题有一个新问题:
我希望“á”与音节 ($\mu$)、音节 ($\sigma$)、音步 (Ft) 和韵律词 (Pwd) 对齐。“s”应该在左边(就像现在这样),但不要越过。
以下是代码:
\begin{forest}
for tree={s sep=0, inner sep=0.8mm, l=0, parent anchor=south, child anchor=north}
[Pwd [Ft, calign=first [$\sigma$, calign=center [s, tier=word ] [$\mu$ [\'a, tier=word, name=C ] ] [$\mu$, name=B] [$\mu$ [t , name=D ] ] ] [$\sigma$, name=A [$\mu$ [u, tier=word ] ] ] ] ]
\draw[-] (D.north)--(A.south);
\draw[-] (C.north)--(B.south);
\end{forest}
\end{document}
谢谢
答案1
如果您考虑切换到forest
,那么您只需要设置适当的calign
键。(forest
在我看来,它比有很多优点,tikz-qtree
并且基于tikz
,所以您也可以使用所有tikz
内容。)
\documentclass{article}
\usepackage[edges]{forest}
\usepackage{tipa}
\begin{document}
\begin{forest}
for tree={parent anchor=south,where level={1}{calign=first}{calign=last}}
[Pwd
[Ft
[$\sigma$
[\ae ]
]
[$\sigma$
[l ]
[\textipa{\textschwa}
]
]
]
[Ft
[$\sigma$
[b ]
[\ae ]
]
[$\sigma$
[m ]
[\textipa{\textschwa}
]
]
]
]
\end{forest}
\end{document}
答案2
TI 并不难钾Z 的matrix
:
\documentclass[tikz]{standalone}
\usepackage{tipa}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of nodes,nodes={minimum width=.8cm}] {%
& & & & PWd & &\\[2em]
Ft & & & & Ft & &\\[2em]
$\sigma$ & & $\sigma$ & & $\sigma$ & & $\sigma$\\[2em]
\`\ae & l & \textipa{\textschwa} & b & \'\ae & m & \textipa{\textschwa}\\
};
\draw (m-2-1.north) -- (m-1-5.south) -- (m-2-5.north);
\draw (m-3-1.north) -- (m-2-1.south) -- (m-3-3.north);
\draw (m-3-5.north) -- (m-2-5.south) -- (m-3-7.north);
\draw (m-4-1.north) -- (m-3-1.south);
\draw (m-4-2.north) -- (m-3-3.south) -- (m-4-3.north);
\draw (m-4-4.north) -- (m-3-5.south) -- (m-4-5.north);
\draw (m-4-6.north) -- (m-3-7.south) -- (m-4-7.north);
\end{tikzpicture}
\end{document}