1.6.3 • Published 8 years ago

flowtex v1.6.3

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

Flowtex

Flowtex allows to easily create flowcharts with tikz for LaTeX.

Installation

npm install -g flowtex

You have to install tex/flowtex.sty in your LaTeX working directory to use it.

wget https://raw.githubusercontent.com/pierre-luc/flowtex/master/tex/flowtex.sty

Flowtex use LaTeX packages: tikz and xcolor. The extension flowtex import tikz and xcolor.

Render based on

The extension flowtex.sty is based on the following external definitions: https://www.sharelatex.com/blog/2013/08/29/tikz-series-pt3.html

API

  • Template:
    • Nodes:
      • N: Start or stop node
      • D: Conditionnal node
      • IO: Input or output node
      • P: Process node
  • LaTeX Formatter:
    • Arrows:
      • <- : $\leftarrow$
      • -> : $\rightarrow$
    • Text
      • Bold
        • **text** : \textbf{text}
  • Methods:

    • Size:

      • _node_.width(_Number_)
    • Placements:

      • _originNode_.above(_node_): node is above of originNode
      • _originNode_.below(_node_): node is below of originNode
      • _originNode_.left(_node_): node is left of originNode
      • _originNode_.right(_node_): node is right of originNode
    • Arrows:

      • _originNode_.goto(_targetNode_)
        • Arrow style as next goto declaration: _gotoCall_(_targetNode_).brokenArrow(): |- tikz style _gotoCall_(_targetNode_).offsetArrow(x, y): offsets of start point from origin node
    • Placements with Arrows:

      • _originNode_.aboveGoto(_node_)
      • _originNode_.belowGoto(_node_)
      • _originNode_.leftGoto(_node_)
      • _originNode_.rightGoto(_node_)
    • Labels:

      • leftLabel(_string_)
      • rightLabel(_string_)
      • topLabel(_string_)
      • downLabel(_string_)

How to

tutorial

Example

Sample render

Input Easy Flowtex code

Nodes declarations first and arrows declarations in second time.

flowchart.offsetX("3");
flowchart.unit("cm"); // default

a = N("Node A").below(
  b = P("Node B")
    .leftGoto(c = P("Node C")).downLabel('Label A')
    .rightGoto(d = P("Node D")).downLabel('Label C')
);

a.goto(c).leftLabel('Label C');
a.goto(d).rightLabel('Label D');
b.goto(a).rightLabel('Label C');

Input Rich Flowtex code

Nodes declarations and arrows declarations in same time.

flowchart.offsetX("3");
flowchart.unit("cm"); // default

N("Node A")
    .origin("a")
    .target("b").rightLabel("Label C")
.below(
    P("Node B").origin("b").origin("c")
    .left(
        P("Node C")
            .target("a").leftLabel("Label B")
            .target("c").downLabel("label A")
    )
    .right(
        P("Node D")
            .target("a").rightLabel("Label D")
            .target("c").downLabel("label C")
    )
);

Generate latex code

flowtex sample.js

Output Tikz code for LaTeX:

\begin{center}
    \begin{tikzpicture}[node distance=2cm]
        \node (node0) [startstop] {Node A};
        \node (node1) [process, below of=node0] {Node B};
        \node (node2) [process, left of=node1, xshift=-3cm] {Node C};
        \node (node3) [process, right of=node1, xshift=3cm] {Node D};
        \draw [arrow] (node0) --node[anchor=east] {Label B} (node2);
        \draw [arrow] (node0) --node[anchor=west] {Label D} (node3);
        \draw [arrow] (node1) --node[anchor=west] {Label C} (node0);
        \draw [arrow] (node1) --node[anchor=north] {label A} (node2);
        \draw [arrow] (node1) --node[anchor=north] {label C} (node3);
    \end{tikzpicture}
\end{center}
1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.2

8 years ago

1.4.1

8 years ago

1.4.0

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.8

8 years ago

1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.4

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago