如何改变整棵树在纸上的位置?
我尝试将树向右移动 3 厘米,向下移动 10 厘米,但没有成功:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[all]{genealogytree}
\pagestyle{empty}
% /gtr/set position=node at position
% (style, no default)
% Adjusts the current graph such that a node of the graph is placed at the given position.
% If the position is given by coordinates, one has to use curly brackets to enclose the position.
% (Handbook ``5.9 tree positioning options'', p.109)
\begin{document}
\begin{tikzpicture}
\genealogytree
[
template=signpost,timeflow=down,
set position=son1 at {3cm,10cm} % doesn't work :(
]{
parent[id=g1]{
g[id=son1,male]{son 1}
c[male]{son 2}
c[female]{daughter}
parent{
g[male]{father}
p[male]{grandpa 1}
p[female]{grandma 1}
}
parent{
g[female]{mother}
p[male]{grandpa 2}
p[female]{grandma 2}
}
}
}
\end{tikzpicture}
\end{document}
答案1
添加了node
和adjust position
。
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[all]{genealogytree}
\pagestyle{empty}
% /gtr/set position=node at position
% (style, no default)
% Adjusts the current graph such that a node of the graph is placed at the given position.
% If the position is given by coordinates, one has to use curly brackets to enclose the position.
% (Handbook ``5.9 tree positioning options'', p.109)
\begin{document}
\begin{tikzpicture}
\node(X)[above=10cm] at (0,0) {}; %added this line
\genealogytree
[
template=signpost,timeflow=down,
adjust position=son1 right of {0,0} distance 3cm %added this line
]{
parent[id=g1]{
g[id=son1,male]{son 1}
c[male]{son 2}
c[female]{daughter}
parent{
g[male]{father}
p[male]{grandpa 1}
p[female]{grandma 1}
}
parent{
g[female]{mother}
p[male]{grandpa 2}
p[female]{grandma 2}
}
}
}
\end{tikzpicture}
\end{document}
- 有关来源,请查看下面我评论中的 google 链接。