家谱树中有多条婚姻线

家谱树中有多条婚姻线

我正在使用 genealogytree 包,并且想使用多行作为家庭标签(通常在其中写入婚姻等数据)

\documentclass{report}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

我试过这个,但是包忽略了换行符。我该怎么办?

答案1

标签选项可以通过 给出label options。这些是 TikZ 节点选项。

对于多行文本,您需要类似的内容align=center

下面显示了具有更多可玩选项的应用程序:

\documentclass{report}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,
    label options={align=center,font=\footnotesize,
      inner sep=1pt,fill=white,opacity=0.75,text opacity=1}
    ]{
    child[family label={\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

enter image description here

答案2

为了允许换行,您可以插入一个垂直框,例如 aminipage或 a \parbox。这需要您指定框的宽度,但您可能希望自动确定,因此您可以使用包pbox来获取 a parbox,它会自动缩小到所需的宽度。您仍然必须指定最大行宽。我只会使用\textwidth,但如果一行太长,您可以插入更小的尺寸来实现自动换行:

\documentclass{report}
\usepackage[all]{genealogytree}
\usepackage{pbox}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label=\pbox{\textwidth}{\gtrsymMarried~first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}

% If you prefer a centered symbol:
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label=\gtrsymMarried\scriptsize~\pbox{\textwidth}{first line\\another line}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}

\end{document}

enter image description here

答案3

使用堆栈或 TABstacks,您可以获得多种外观:

\documentclass{report}
\usepackage[all]{genealogytree}
\usepackage{tabstackengine}
\setstacktabbedgap{3pt}
\begin{document}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\Longstack{\gtrsymMarried~first line\\another line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\scriptsize\tabbedLongstack[l]{\gtrsymMarried&first line\\&next line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried\scriptsize\ \Centerstack[l]{first line\\next line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}\bigskip

\begin{tikzpicture}
\genealogytree[template=signpost,label options={fill=white,node font=\footnotesize}]{
    child[family label={\gtrsymMarried\setstackgap{L}{5.5pt}\tiny\ \Centerstack[l]{first line\\next line\\last line}}]{
        g[female]{me}
        p[male]{my husband}
        c[female]{our lovely daughter}
    }
}
\end{tikzpicture}
\end{document}

enter image description here

相关内容