The xshift
in the following figure breaks the bounding box:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{scopes}
\usetikzlibrary{chains}
\usetikzlibrary{backgrounds} % used only for testing with "framed"
\newcommand{\parlistrdeepseq}{
\begin{tikzpicture}
[start chain=going below,
every on chain/.append style={join},
every join/.style={->},
framed]
\node[on chain] { map f (28:28:28:28:[]) };
\node(x1)[on chain] { f 28 : (map f (28:28:28:[])) };
% \node(y1)[below=of \tikzchainprevious.south, xshift=-3cm] {|f 28|};
{ [start chain=t1 going below]
\node(y1)[on chain, left=of x1, yshift=-1cm] {f 28};
\node[on chain] {514229};
\path (x1.south west) edge[->] (y1);
}
\node(x2)[on chain] { y : f 28 : (map f (28:28:[])) };
{ [start chain=t2 going below, transform canvas={xshift=1cm}]
\node(y2)[on chain, left=of x2, yshift=-1cm] {f 28};
\node[on chain] {514229};
\path (x2.south west) edge[->] (y2);
}
\node[on chain] { y : y : y : y []};
\end{tikzpicture}}
\begin{document}
\parlistrdeepseq
\end{document}
The output with the wrong bounding box is:
Best Answer
It's not the
xshift
, it's thetransform canvas
that causes this behaviour. As it says in thepgfmanual
:You should put the
xshift
into the options for they2
node instead: