包含流程图的问题

包含流程图的问题

我正在尝试将流程图作为图表包含在文档中,但我认为我做错了。编译后,我的 PDF 文档中出现空白页。我使用的是 MiKTeX 2.9 和 Windows 7。以下是 LaTeX 文件的一部分:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tikz}
\usetikzlibrary{matrix, shapes, arrows, positioning}
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
\begin{document}
\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill=blue!20, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]
\begin{figure}
\centering
\begin{tikzpicture}[node distance = 2cm, auto]\label{flowchart:algorithmchart}
 Place nodes with matrix nodes
 \matrix[matrix of nodes, column sep=1cm, row sep=1cm]{%
    \node [block] (init) {Set Quotient to 0};\\
    \node [block] (identify) {Subtract Divisor from Dividend};\\
    \node [block] (evaluate) {Add 1 to Quotient};\\
    \node [decision] (decide) {is Result Register Greater than 0?};\\
    \node [block] (stop) {Stop - Quotient is Correct};\\};
 Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -- node[right]{No} (stop);
    \path [line] (stop) -- ++(2,0) |- (identify);
  \end{tikzpicture}
\end{figure}
\end{document} 

相关内容