谁能告诉我为什么以下脚本在图的左侧有非零边距???
\documentclass[class=minimal,border=0pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
% Define block styles
\tikzstyle{block} = [rectangle, draw, line width=0.5mm, black,
text width=5em, text centered, rounded corners, minimum height=2em]
\tikzstyle{line} = [draw, -latex]
\begin{tikzpicture}[node distance = 1cm, auto]
% Place nodes
\node [block] (BLOCK1) {a};
\node [block, below of=BLOCK1] (BLOCK2) {b};
\node [block, below of=BLOCK2, node distance=1cm] (BLOCK3) {c};
% Draw edges
\path [line] (BLOCK1) -- (BLOCK2);
\path [line] (BLOCK2) -- (BLOCK3);
\end{tikzpicture}
\end{document}
答案1
您的代码在使用后产生了虚假空格]
(\tikzstyle
顺便说一下,这已被弃用)
%
您可以在这些内容之后添加]
,或者按照我的建议将这些定义移出序言。
minimal
此外,也不建议使用该类,这就是我更改class=minimal
为class=article
(默认)的原因。
参考
代码
\documentclass[class=article,border=0pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
% Define block styles
\tikzset{
block/.style={rectangle, draw, line width=0.5mm, black, text width=5em, text centered, rounded corners, minimum height=2em},
line/.style={draw, -latex}
}% <- if you insist in using this in the document add this % here.
\begin{document}
\begin{tikzpicture}[node distance = 1cm, auto]
% Place nodes
\node [block] (BLOCK1) {a};
\node [block, below of=BLOCK1] (BLOCK2) {b};
\node [block, below of=BLOCK2, node distance=1cm] (BLOCK3) {c};
% Draw edges
\path [line] (BLOCK1) -- (BLOCK2);
\path [line] (BLOCK2) -- (BLOCK3);
\end{tikzpicture}
\end{document}