家譜樹婚姻標籤位置

家譜樹婚姻標籤位置

我正在使用 generictree 套件來製作沙鐘結構,但我也將連接已婚夫婦的邊緣向上移動,使它們與節點的中心齊平。我正在使用距離、斷開連接和額外邊緣的選項來獲得我想要的佈局,並且一切正常,但我不知道如何將標籤與結婚日期一起移動。在這種情況下有一個簡單的選擇嗎?我提供了我所擁有的內容以及生成它的程式碼的螢幕截圖。我希望 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}};

微量元素

\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}

在此輸入影像描述

相關內容