When drawing tikz automata, I always omit the inital text and only use an arrow to indicate that a state is initial. To this end, I add
\tiksset[initial text={}]
to the preamble of my tex file.
This works fine so far, but when I was positioning several automata horizontally in a figure, I noticed that the initial arrow occupies to much space. You can see this phenomenon in the following picture. The red rectangle shows the bounding box.
I suspect that this happens because the node for the text is still there and has a nonnegative size. However, I would like to have the bounding box start where the arrow starts. Does anyone know how to achieve this without changing the bounding box by hand? Tanks!
The picture above results from the following code.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata}
\tikzset{initial text={}}
\begin{document}
\begin{tikzpicture}
\node[state, initial] {};
\draw[red, dashed] (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
\end{document}
Best Answer
It's because when you clear the text of the initial node you don't actually decrease the node size. I've added a
draw
to the node options to make it obvious that your guess is correct:Instead of
draw
you can put aninner sep=0
which is a good approximation, or delete the node or addoverlay
to keep the node but not include it in the bounding box.