2

There is a problem with using the standalone output and plotting a simple tree graph with Tikz. The image is neither correctly centralize nor cropped. I added a huge border to show at least something.

See my minimal working example and the output I get with LuaTeX, Version 1.10.0 (TeX Live 2019).

% Preamble
\documentclass[tikz, border=5cm]{standalone}

% Packages
\usepackage{tikz}
\usetikzlibrary{graphdrawing,graphs}
\usegdlibrary{trees}

% definitions of entries here
\def\ItemI{Lorem ipsum\\lorem ipsum\\lorem ipsum}
\def\ItemII{Lorem ipsum}
\def\ItemIII{Lorem ipsum}
\def\ItemIV{Lorem ipsum}
\def\ItemV{Lorem ipsum}
\def\ItemVI{Lorem ipsum}
\def\ItemVII{Lorem ipsum}

% Document
\begin{document}
  \begin{tikzpicture}
    \tikz[tree layout,
    % specifying the text width in nodes fails
    nodes={fill=blue!20, align=center},
    % specifying the text width in child node has no effect
    % every child node/.style={minimum height=1.8cm,text width=2.5cm}
    ]
    \graph[]{
      1[as=\ItemI] -> {
        11[as=\ItemII] -> {
          111[as=\ItemIII],
          112[as=\ItemIV],
        },
        12[as=\ItemV] -> {
          121[as=\ItemVI],
        },
        13[as=\ItemVII],
      },
    };
  \end{tikzpicture}
\end{document}

graph non-centered and cropped I checked multiple comparable issues (e.g. 1, 2, 3) but could not find a solution.

3
  • 1
    The problem is, that you say \tikz[tree layout,..... Delete that \tikz – cis Sep 25 '20 at 17:54
  • If I leave that out, then the tree layout of course also vanishes but I would like to keep it. – Porst Sep 29 '20 at 12:18
  • I don't understand: \tikz[...] is something like a synonym to \begin{tikzpicture}[...]. You use both of them; and you use \tikz inside \begin{tikzpicture}, that's rarely a good idea; and here it is wrong. – cis Sep 30 '20 at 20:00

Your Answer

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

Browse other questions tagged or ask your own question.