なぜ左側に余白が多いのですか?

なぜ左側に余白が多いのですか?

私は持っているこの図:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit,arrows,calc,positioning}

\begin{document}
\tikzstyle{b} = [rectangle, draw, fill=white, node distance=1cm, text width=6em, text centered, rounded corners, minimum height=4em, thick]
\tikzstyle{l} = [draw, -latex',thick]

\begin{tikzpicture}[auto]
    \node [b] (box1) {box1};
    \node [b, right=of box1] (box2) {box2};
    \path [l] (box1) -- (box2);

\end{tikzpicture}
\end{document}

右側に比べて左側に余裕があるのはなぜですか?

答え1

空白としてカウントされるのは、スタイル宣言と空行です。

空白行を削除し、スタイルを TikZ 環境に配置すれば、再び正常になります。

そして、ぜひご覧くださいTikZ スタイルを定義するには、\tikzset または \tikzstyle を使用する必要がありますか?

最も簡単なのは、シンプルな

\tikzset{
    b/.style={rectangle, draw, fill=white, node distance=1cm, text width=6em, text centered, rounded corners, minimum height=4em, thick},
    l/.style={draw, -latex',thick}
}

前文に記載されていれば、その後はどこでも有効となります。

関連情報