5

Could anyone tell me why the following scripts have non-zero margin in the left side of the figure????

\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}
Daniel
  • 1,816

1 Answers1

5

Your code produces spurious spaces after the ] from your \tikzstyle use (which is deprecated by the way)

Either you add % after those ] or, which I would recommend, you move these definition ot the preamble.

Also, the usage of the minimal class is not recommended either, which is the reason I have changed class=minimal to class=article (the default).

References

Code

\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}
Qrrbrbirlbel
  • 119,821