
나는 tikz-qtree 패키지를 사용하여 이 트리를 만들려고 노력해 왔습니다. 여러 부분이 있지만 점선을 만들 수 없습니다.
\documentclass[a4paper,12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts, amsmath, amsthm, amssymb}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}[scale=1.2,every node/.style={align=center}]
\tikzset{level distance=50pt,sibling distance=5pt}
\Tree [.{$\alpha(\beta)$}:$\tau^a$
[.{$\alpha$}:$\langle\sigma^a,\tau^a\rangle$ $\bullet$\\$\gamma:\rho^c$
]
[.$\beta$:$\sigma^a$ $\bullet$\\$\delta:\vartheta^c$ ] ]
\end{tikzpicture}
\end{document}
점선으로 할 수 있나요?
답변1
tikz
원하는 옵션을 사용하여 트리에 노드를 생성하는 데 사용할 수 있습니다 . 예를 들어 다음과 같이 모서리가 둥근 점선 테두리가 있는 레이블이 있는 노드를 만들 수 있습니다.
\begin{tikzpicture}
[
scale=1.2,
every node/.style={align=center},
level distance=50pt,
sibling distance=5pt,
]
\Tree
[.{$\alpha(\beta)$}:$\tau^a$
[.{$\alpha$}:$\langle\sigma^a,\tau^a\rangle$ \node[label={[draw, densely dotted, rounded corners]below:\strut$\gamma:\rho^c$}]{$\bullet$};
]
[.$\beta$:$\sigma^a$ \node[label={[draw, densely dotted, rounded corners]below:\strut$\delta:\vartheta^c$}]{$\bullet$};
]
]
\end{tikzpicture}
forest
그러나 Ti의 모든 기능을 제공하는 것을 권장합니다.케이Z 등. 원하는 경우 최종 선을 노드에 넣고 원하는 옵션을 사용하여 Forest에서 자동으로 원을 추가하고 점선 테두리 등을 동시에 추가할 수 있습니다. 예를 들어 트리의 서문에 다음 코드를 사용할 수 있습니다.
for tree={
math content,
기본적으로 노드에는 수학 콘텐츠가 있습니다.
parent anchor=children,
child anchor=parent,
좀 깔끔하게 정리하세요.
},
before typesetting nodes={
모든 것이 준비될 때까지 이 작업을 연기하세요.
where n children=0{
터미널 노드에만 해당됩니다.
no edge,
그들에게 우위를 점하지 마십시오.
draw,
테두리를 그려주세요.
densely dotted,
그 테두리를 촘촘한 점으로 만드세요.
content/.wrap value={\strut#1},
모두 같은 높이로 만드세요.
rounded corners,
모서리를 둥글게 만듭니다.
replace by={[, circle, fill, no edge, inner sep=0pt, minimum size=5pt, append]}
작고 채워진 원인 터미널 노드 앞에 다른 노드를 삽입합니다. 해당 노드에도 가장자리를 그리지 마십시오. 노드는 replace by
원본과 대체물을 결합한 다음 append
원본을 결합하여 주장됩니다. 그렇지 않으면 원래 노드가 모두 저장되지 않았고 노드를 이동하려고 하면 내용을 잃을 수 있기 때문에 나중에 이 작업을 수행합니다.
}{}
터미널이 아닌 노드에는 아무 작업도 수행하지 마세요.
}
지연된 내용을 마치겠습니다.
이를 통해 우리는 항상 수학 모드로 전환하지 않고도 트리 자체를 매우 간결하게 지정할 수 있습니다.
[\alpha(\beta):\tau^a
[{\alpha:\langle\sigma^a,\tau^a\rangle}
[\gamma:\rho^c
]
]
[\beta:\sigma^a
[\delta:\vartheta^c
]
]
]
이것을 조립하면,
\begin{forest}
for tree={
math content,
parent anchor=children,
child anchor=parent,
},
before typesetting nodes={
where n children=0{
no edge,
draw,
densely dotted,
content/.wrap value={\strut#1},
rounded corners,
replace by={[, circle, fill, no edge, inner sep=0pt, minimum size=5pt, append]}
}{}
}
[\alpha(\beta):\tau^a
[{\alpha:\langle\sigma^a,\tau^a\rangle}
[\gamma:\rho^c
]
]
[\beta:\sigma^a
[\delta:\vartheta^c
]
]
]
\end{forest}
생산하다
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{tikz-qtree}
\usepackage{forest}
\begin{document}
\begin{tikzpicture}
[
scale=1.2,
every node/.style={align=center},
level distance=50pt,
sibling distance=5pt,
]
\Tree
[.{$\alpha(\beta)$}:$\tau^a$
[.{$\alpha$}:$\langle\sigma^a,\tau^a\rangle$ \node[label={[draw, densely dotted, rounded corners]below:\strut$\gamma:\rho^c$}]{$\bullet$};
]
[.$\beta$:$\sigma^a$ \node[label={[draw, densely dotted, rounded corners]below:\strut$\delta:\vartheta^c$}]{$\bullet$};
]
]
\end{tikzpicture}
\begin{forest}
for tree={
math content,
parent anchor=children,
child anchor=parent,
},
before typesetting nodes={
where n children=0{
no edge,
draw,
densely dotted,
content/.wrap value={\strut#1},
rounded corners,
replace by={[, circle, fill, no edge, inner sep=0pt, minimum size=5pt, append]}
}{}
}
[\alpha(\beta):\tau^a
[{\alpha:\langle\sigma^a,\tau^a\rangle}
[\gamma:\rho^c
]
]
[\beta:\sigma^a
[\delta:\vartheta^c
]
]
]
\end{forest}
\end{document}