Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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}
share|improve this answer
2  
And don't use class=minimal –  egreg Mar 13 '13 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.