家谱婚姻标签位置

家谱婚姻标签位置

我正在使用 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}};

平均能量损失

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

在此处输入图片描述

相关内容