
나는 모래시계 구조를 만들기 위해 genealogytree 패키지를 사용하고 있지만, 결혼한 커플을 연결하는 가장자리를 위쪽으로 이동하여 노드의 중심과 수평을 이루도록 하고 있습니다. 원하는 레이아웃을 얻기 위해 거리, 연결 끊김 및 추가 가장자리에 대한 옵션을 사용하고 있으며 모두 잘 작동하지만 결혼 날짜에 따라 레이블을 이동하는 방법을 모르겠습니다. 이 상황에서 그렇게 할 수 있는 간단한 옵션이 있습니까? 내가 가지고 있는 것과 그것을 생성하는 코드의 스크린샷을 포함하고 있습니다. 나는 1850이 아버지와 어머니를 연결하는 선 바로 위로 이동되기를 바랍니다.
\begin{genealogypicture}[template=signpost,
options for family={fam1}{extra edges={Fa,Mo}{C2}
{yshift=12mm}},
options for family={fam2}{extra edges={GF,GM}{Fa}
{yshift=-13mm}}]
sandclock
{child[id=fam1,family database={marriage={1850}{}}]
{g[id=Fa,male,disconnect]{Father} p[id=Mo,
female,distance=1cm,disconnect]{Mother}
child{g[id=C1,male]{Child1}}
child{g[id=C2,male]{Child2}}
child{g[id=C3,female]{Child3}}
}
parent[id=fam2]{g[id=GF,male]{Grandfather} }
parent{g[id=GM,female,distance=1cm,disconnect]
{Grandmother}}
}
\end{genealogypicture}
답변1
label options={fill=white},
녹색 선을 차단하는 데 사용
\documentclass{standalone}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,
label options={fill=white},
options for node={A}{box={colback=blue!30}},
options for node={B}{box={colback=green!30}},
options for family={AB}{label={\gtrsymMarried 2006}}
% show id,
]{
child[id=AB]{
g[id=A]{Father}
p[id=B]{Mother}
c[id=c1]{Child 1}
c[id=c2]{Child 2}
c[id=c3]{Child 3}
}
}
\end{tikzpicture}
\end{document}
편집1
선택적으로 다음을 사용하여 부모 간의 결혼 레이블을 중앙에 배치할 수 있습니다.
\draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=2pt},
line width=1pt,yshift=0pt] (A.south east) -- (A.north east)
node [align=center,right=10pt,midway,fill=yellow] {{\gtrsymMarried 2006}};
\draw [decorate,decoration={brace,amplitude=5pt,raise=2pt},
line width=1pt,yshift=0pt] (B.south west) -- (B.north west);
왼쪽 중괄호는 코드에 의해 배치됩니다.
\draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=2pt},
line width=1pt,yshift=0pt] (A.south east) -- (A.north east)
오른쪽 가새는 코드에 의해 배치됩니다. mirror
가새 면을 반전시키는 명령이 제거되었습니다.
\draw [decorate,decoration={brace,amplitude=5pt,raise=2pt},
line width=1pt,yshift=0pt] (B.south west) -- (B.north west);
결혼 라벨은 다음의 도움으로 배치됩니다.
node [align=center,right=10pt,midway,fill=yellow] {{\gtrsymMarried 2006}}
전체 MWE:
\documentclass{standalone}
\usepackage[all]{genealogytree}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,
label options={fill=white},
options for node={A}{box={colback=blue!30}},
options for node={B}{box={colback=green!30}},
options for family={AB}{label={\gtrsymMarried 2006}},
% show id,
options for node={B}{distance=2cm},
]{
child[id=AB]{
g[id=A]{Father}
p[id=B]{Mother}
c[id=c1]{Child 1}
c[id=c2]{Child 2}
c[id=c3]{Child 3}
}
}
\draw [decorate,decoration={brace,amplitude=5pt,mirror,raise=2pt},
line width=1pt,yshift=0pt] (A.south east) -- (A.north east)
node [align=center,right=10pt,midway,fill=yellow] {{\gtrsymMarried 2006}};
\draw [decorate,decoration={brace,amplitude=5pt,raise=2pt},
line width=1pt,yshift=0pt] (B.south west) -- (B.north west);
\end{tikzpicture}
\end{document}
노드가 Father Mother
2cm씩 분리되었습니다.
편집2
중괄호 없는 결합 - 단순히 2개의 그리기 명령을 삭제하고 대체합니다.
\draw (A.east) node [right=10pt,fill=yellow] {{\gtrsymMarried 2006}};
MWE
\documentclass{standalone}
\usepackage[all]{genealogytree}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,
label options={fill=white},
options for node={A}{box={colback=blue!30}},
options for node={B}{box={colback=green!30}},
options for family={AB}{label={\gtrsymMarried 2006}},
% show id,
options for node={B}{distance=2cm},
]{
child[id=AB]{
g[id=A]{Father}
p[id=B]{Mother}
c[id=c1]{Child 1}
c[id=c2]{Child 2}
c[id=c3]{Child 3}
}
}
\draw (A.east) node [right=10pt,fill=yellow] {{\gtrsymMarried 2006}};
\end{tikzpicture}
\end{document}