
我有這個數字:
\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環境下就OK了。
請看一下應該使用 \tikzset 或 \tikzstyle 來定義 TikZ 樣式嗎?
最簡單的是使用一個簡單的
\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}
}
在序言中,此後在任何地方都有效。