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.

Sebastiano
  • 54,118
Porst
  • 21
  • 3
    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
  • 2
    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
  • 1
    The tree layout, ... options do need to be supplied, but should be directly given as optional arguments of the tikzpicture environment. You need to supply them as \begin{tikzpicture}[tree layout, ..., the extra \tikz in there is, as cis says, is starting an additional TikZ picture which is messing up something. – Dai Bowen Jun 29 '23 at 13:46
  • 1
    I’m voting to close this question because: solved in comments in 2020 (!), spurious "\tikz". – Stephen Jun 29 '23 at 14:35

0 Answers0