1

Is there something like a command \gtrDBid working like \gtrDBsex in the package genealogytree?

My setting to understand the usage of this command:

  • The file

    family/family.tex  
    

    holds the tex-code for the genealogytree.

  • In directory

    db/
    

    are all pictures saved with the id for the person in filename. Pattern is

    P-<id>.jpg
    

    For example: db/P-ForenameSurename1990.jpg

My example code works so far:

\documentclass[]{standalone}

\usepackage[all]{genealogytree}
\gtrloadlanguage{german}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{hyperref}


\begin{document}


    \gtrset{image prefix=../db/P-}
    \gtrset{language=german}

    \gtrset{gauss/.style={
            processing=database,
            node size=2.4cm,
            level size=3.5cm,
            box={
                fit basedim=7pt,boxsep=2pt,segmentation style=solid, halign=flush left,before upper=\parskip1pt, \gtrDBsex,drop fuzzy shadow, 
                if image defined={
                    %add to width=25mm,right=25mm,
                    width=49mm,right=25mm, 
                    underlay={
                        \begin{tcbclipinterior}\path[fill overzoom image=\gtrDBimage]
                            ([xshift=-24mm]interior.south east) rectangle (interior.north east);
                        \end{tcbclipinterior}},
                    }{},
                },
            }
        }


    \begin{tikzpicture}[scale=0.94,transform shape]

    \genealogytree[
        gauss, 
    ]{
        child{
            g[id=SurnameForename1990]{
                male,
                name={\pref{Forename} \surn{Surename}},
                birth={1990-01-01}{Home},
                comment={\LaTeX-enthusiast, \gtrDBsex},
                image=SurnameForename1990.jpg,
            }
        }
    }

    \end{tikzpicture}

\end{document}

What I now want to do, is to change the line

image=SurnameForename1990.jpg,

into something like

image=\gtrDBid.jpg,

Are there any possibilites? Thank you!

  • Welcome to TeX.se and thanks for posting an example document. Doesn't the \gtrDBimage macro described in §2.3.4 of the manual do what you want? (No idea, I've never used the package). – Alan Munn Apr 16 '17 at 14:15
1

The id can be displayed by \gtrnodeid, but this macro is too cunning to be used like you want to. The more basic \gtr@gkv@id can be used instead.

The following solution will only work

  • if every person has an associated id
  • if every person has an image following your pattern.

If your applications fulfills these prerequisites, try the following:

\documentclass[]{standalone}

\usepackage[all]{genealogytree}
\gtrloadlanguage{german}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}


\begin{document}

    \makeatletter
    %\gtrset{image prefix=../db/P-}
    \gtrset{language=german}

    \gtrset{gauss/.style={
            processing=database,
            node size=2.4cm,
            level size=3.5cm,
            box={
                fit basedim=7pt,boxsep=2pt,segmentation style=solid, halign=flush left,before upper=\parskip1pt, \gtrDBsex,drop fuzzy shadow,
                %if image defined={
                    %add to width=25mm,right=25mm,
                    width=49mm,right=25mm,
                    underlay={
                        \begin{tcbclipinterior}\path[fill overzoom image=../db/P-\gtr@gkv@id]
                            ([xshift=-24mm]interior.south east) rectangle (interior.north east);
                        \end{tcbclipinterior}},
                %    }{},
                },
            }
        }
    \makeatother

    \begin{tikzpicture}[scale=0.94,transform shape]

    \genealogytree[
        gauss,
    ]{
        child{
            g[id=SurnameForename1990]{
                male,
                name={\pref{Forename} \surn{Surename}},
                birth={1990-01-01}{Home},
                comment={\LaTeX-enthusiast, \gtrDBsex},
                %image=SurnameForename1990.jpg,
            }
        }
    }

    \end{tikzpicture}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.