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
- Nodes:
- LaTeX Formatter:
- Arrows:
- <- : $\leftarrow$
- -> : $\rightarrow$
- Text
- Bold
- **text** : \textbf{text}
- Bold
- Arrows:
- 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
- Arrow style as next goto declaration:
-
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
Example
Input Easy Flowtex code
Nodes declarations first and arrows declarations in second time.
flowchart;flowchart; // default a = below b = ; a;a;b;
Input Rich Flowtex code
Nodes declarations and arrows declarations in same time.
flowchart;flowchart; // default target"b"below left target"a" target"c" right target"a" target"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}