T-F-S / genealogytree

pedigree and genealogy tree diagrams
LaTeX Project Public License v1.3c
47 stars 7 forks source link

Using custom edges #49

Open scottb5612 opened 5 months ago

scottb5612 commented 5 months ago

I can build the example on page 211 of the manual, but I cannot build my own graph, which results in an error unless I take out the 3rd generation.

_./tree.tex:43: ./tree.tex:43: Undefined control sequence.

\gtr@dat@draw@chi l.43 } ? Undefined control sequence. \gtr@dat@draw@chi l.43 }_ Here is my code. I've defined \myedgedraw as in the example \begin{tikzpicture} \genealogytree[ template=signpost, % These work box={halign=center,valign=center}, edges={no background,foreground={blue,Circle-Latex}}, % % These do not %box={enhanced jigsaw,opacityback=0.75}, %edges={ custom={\myedgedraw}{\myedgedraw}{\myedgedraw}{\myedgedraw}, }, ] %%% { child{ g[male]{GG1} p[female]{GG2} child[]{ g[female]{G1} p[male]{G2} } } }
T-F-S commented 5 months ago

In your example, there a no childs for the 3rd generation. Therefore, the children etoolbox macro is not defined causing the error.

To avoid the problem, the \myedgedraw code should be made more fail-safe:

\documentclass{article}
\usepackage{lmodern,incgraph}
\usepackage[all]{genealogytree}

\newcommand{\myedgedraw}[4]{%
  % parents (#1):
  \ifdef{#1}{%
    \renewcommand*{\do}[1]{
      \draw[#4] (##1)--(#3);
      \path[draw=green!50!black,fill=green!30] (##1) circle (3pt);}%
    \dolistloop{#1}%
  }{}%
  % children (#2):
  \ifdef{#2}{%
    \renewcommand*{\do}[1]{
      \draw[#4] (##1)--(#3);
      \path[draw=yellow!50!black,fill=yellow!50] (##1) circle (3pt);}%
    \dolistloop{#2}%
  }{}%
  % family core (#3):
  \path[draw=purple!50!black,fill=purple!50] (#3) circle (3pt);
}

\begin{document}

\begin{tikzpicture}
\genealogytree[ template=signpost,
  box={enhanced jigsaw,opacityback=0.75},
  edges={
    custom={\myedgedraw}{\myedgedraw}{\myedgedraw}{\myedgedraw},
  },
]
%%%
{
  child
  {
    g[male]{GG1}
    p[female]{GG2}
    child[]
    {
      g[female]{G1}
      p[male]{G2}
    }
  }
}
\end{tikzpicture}

\end{document}

grafik

I will update the documentation example with this enhanced code for the next version.

scottb5612 commented 5 months ago

Many thanks for working this out ...

I have a question. Is there a way to suppress parts of the tree in order to display, say a few generations, starting from an internal node? It would come in very handy. I could write parser to do this, that is, I could read the graph into a tree and then reverse compile the back to the original graph, but a cleaner solution would be better.

On Thu, Jun 6, 2024 at 4:28 PM Thomas F. Sturm @.***> wrote:

In your example, there a no childs for the 3rd generation. Therefore, the children etoolbox macro is not defined causing the error.

To avoid the problem, the \myedgedraw code should be made more fail-safe:

\documentclass{article}\usepackage{lmodern,incgraph}\usepackage[all]{genealogytree} \newcommand{\myedgedraw}[4]{% % parents (#1): \ifdef{#1}{% \renewcommand{\do}[1]{ \draw[#4] (##1)--(#3); \path[draw=green!50!black,fill=green!30] (##1) circle (3pt);}% \dolistloop{#1}% }{}% % children (#2): \ifdef{#2}{% \renewcommand{\do}[1]{ \draw[#4] (##1)--(#3); \path[draw=yellow!50!black,fill=yellow!50] (##1) circle (3pt);}% \dolistloop{#2}% }{}% % family core (#3): \path[draw=purple!50!black,fill=purple!50] (#3) circle (3pt); } \begin{document} \begin{tikzpicture}\genealogytree[ template=signpost, box={enhanced jigsaw,opacityback=0.75}, edges={ custom={\myedgedraw}{\myedgedraw}{\myedgedraw}{\myedgedraw}, }, ]%%% { child { g[male]{GG1} p[female]{GG2} child[] { g[female]{G1} p[male]{G2} } } }\end{tikzpicture} \end{document}

grafik.png (view on web) https://github.com/T-F-S/genealogytree/assets/7982989/a2624737-211d-4ee0-8ec0-ebf2cc24b099

I will update the documentation example with this enhanced code for the next version.

— Reply to this email directly, view it on GitHub https://github.com/T-F-S/genealogytree/issues/49#issuecomment-2152683157, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACP6BHN6HO4UQDNLT3MDT23ZGBWYDAVCNFSM6AAAAABI3GSXJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJSGY4DGMJVG4 . You are receiving this because you authored the thread.Message ID: @.***>

T-F-S commented 5 months ago

I have a question. Is there a way to suppress parts of the tree in order to display, say a few generations, starting from an internal node? It would come in very handy.

Yes, there is. You find everything about it in the documention from page 117 in Section 5.11 Ignoring Input, e.g. /gtr/ignore level to ignore generations.

scottb5612 commented 5 months ago

Is there a way to select an internal node from which to start generating a tree?

On Fri, Jun 7, 2024 at 11:29 AM Thomas F. Sturm @.***> wrote:

I have a question. Is there a way to suppress parts of the tree in order to display, say a few generations, starting from an internal node? It would come in very handy.

Yes, there is. You find everything about it in the documention from page 117 in Section 5.11 Ignoring Input, e.g. /gtr/ignore level to ignore generations.

— Reply to this email directly, view it on GitHub https://github.com/T-F-S/genealogytree/issues/49#issuecomment-2154459112, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACP6BHLBNCSFPLXZRCEVNXLZGF4QPAVCNFSM6AAAAABI3GSXJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJUGQ2TSMJRGI . You are receiving this because you authored the thread.Message ID: @.***>

T-F-S commented 5 months ago

Is there a way to select an internal node from which to start generating a tree?

No, the root node (proband) is fixed.