0

I want to make picture with tikz, and then fill background with something.

To do it properly, I want to get the size of picture (height and width). Is there a command that will give me whole size of picture, something working like \textwidth?

I'm doing genealogy tree using genealogytree package, so here is something like MWE. I'm copying the way to add background to image, from example from title page of manual.

\documentclass[11pt]{standalone}
\usepackage[all]{genealogytree}
\usepackage{incgraph}
\usetikzlibrary{backgrounds}
\begin{document}
    \begin{tikzpicture}
        \genealogytree[template=signpost]
        {
            child{
            g{A}
            p{B}
            c{C}
            c{D}
            c{E}
        }
        }
        \begin{scope}[on background layer]
            \node (bg) [fill tile image*={width=4cm}{crinklepaper.png},
            minimum width=5cm, minimum height=5cm,
            inner sep=0pt,outer sep=0pt] at (current bounding box) {};
        \end{scope}
    \end{tikzpicture}
\end{document}

I'm getting something like this

enter image description here

Background is too high and too narrow.

Well, I of course can fine-tune it and write smaller height and bigger width. But it will change the moment I will add something to my genealogy tree.

Is there a way to like export the width of image the way we can export the \textwidth in normal documents?

I want to change minimum width=5cm, minimum height=5cm, with minimum width=\picturewidth, minimum height=\pictureheight,

Hiperon43
  • 157
  • 1
    You can print \the\textrwidth and \the\textheight for a given document class, then use those values to create a minipage with the right dimentsions. Some what related: https://tex.stackexchange.com/questions/423109/export-each-figure-as-a-separate-pdf-file – John Kormylo Jul 08 '22 at 23:30

1 Answers1

3

Using tikz library fit:

\documentclass[11pt]{standalone}
\usepackage[all]{genealogytree}
\usetikzlibrary{backgrounds, fit}

\begin{document} \begin{tikzpicture} \genealogytree[template=signpost] { child{ g{A} p{B} c{C} c{D} c{E} } } \begin{scope}[on background layer] \node (bg) [ fill tile image={crinklepaper.png}, fit=(current bounding box), inner sep=3pt ] {}; \end{scope} \end{tikzpicture} \end{document}

enter image description here

muzimuzhi Z
  • 26,474