从文本符号生成流程图的工具

7

我正在寻找一款基于控制台的工具,可以处理一个包含流程图文字符号的简单文本文件,并生成PNG(或其他格式)文件。可能也有一个LaTeX包可以实现这个功能,但是如果可能的话,我更喜欢一款可以生成独立PNG的工具,然后将其作为图形导入到LaTeX文档中。

2个回答

6
让LaTeX生成流程图而不是生成/导入png文件会更加清晰。这样,您将不会遇到分辨率或欠采样的问题,并且所有内容都将以矢量格式呈现。
您可以使用LaTeX的TikZ包。texexample.net网站提供以下示例。

enter image description here

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}

% Define block styles
\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{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (init) {initialize model};
    \node [cloud, left of=init] (expert) {expert};
    \node [cloud, right of=init] (system) {system};
    \node [block, below of=init] (identify) {identify candidate models};
    \node [block, below of=identify] (evaluate) {evaluate candidate models};
    \node [block, left of=evaluate, node distance=3cm] (update) {update model};
    \node [decision, below of=evaluate] (decide) {is best candidate better?};
    \node [block, below of=decide, node distance=3cm] (stop) {stop};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -| node [near start] {yes} (update);
    \path [line] (update) |- (identify);
    \path [line] (decide) -- node {no}(stop);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line,dashed] (system) |- (evaluate);
\end{tikzpicture}
\end{document}

唯一的问题是,生成PNG文件(而不是PDF文档)将使我能够在其他上下文中独立使用它(例如在网页中),即它将产生更自包含和可重用的工件。 - Marcus Junius Brutus

0

链接无法使用。 - karloswitt
链接已更新,请再试一次。 - asouqi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接