I am creating what seems like a straightforward tree using tikz and forest. The figure is close to what I want, but appears significantly to the left and right of the expected place, outside the bounds of the figure and even the page.
The "1" next to the top node is page numbering.
Code example:
\documentclass[runningheads]{llncs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathabx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{svg.path,positioning,shapes,calc,arrows.meta,graphs,graphdrawing}
\usegdlibrary{trees}
\usepackage{forest}
\def\choicep{\times}
\def\seqop{\rightarrow}
\begin{document}
Introductory text.
\begin{figure}
\begin{tikzpicture}[>=stealth, every node/.style={ellipse,draw},
sibling distance=2pt]
\begin{forest}
for tree={
edge = {->},
ellipse,
draw,
math content,
anchor = center
},
[\choicep:4
[\seqop:1
[a:1]
[b:1]
]
[\seqop:1
[a:1]
[b:1]
]
[\seqop:1
[b:1]
[a:1]
]
[\seqop:1
[c:1]
[c:1]
[c:1]
]
]
\end{forest}
\end{tikzpicture}
\caption{Misaligned tree (skews top right).}
\label{fig:discovery-eg-trace}
\end{figure}
Closing text.
\end{document}
This is an MRE, but I found the behaviour originally within a subfigure, with surrounding text, etc. It happily plonks itself over other text, figures, page headers etc. I am using overleaf.
Seems like it should be something basic but has me scratching my head. I also tried \graph
and the {}
syntax, but that choked on the mathematical symbols for the nodes.
forest
environment is already atikzpicture
therefore your code nest tikzpictures which is not recommended. if you delete thetikzpicture
environment, theforest
diagram will go to their place.