% some LaTeX code % kblocks.sty % TikZ-based block-diagram package for control theory applications % version 2.0 (February 2021) % version 1.0 (October 2019) % % Author: Somefun Oluwasegun {oasomefun@futa.edu.ng} % Change Log: % significant improvements and introduction of new macros and annotation % Credits: % (2014): motivated by the helpful pointers in https://tex.stackexchange.com/users/14704/s-c % (2005): motivated by the TikZ-bloques package by Alejandro Garces {Alejandro Garcesalejandrogarces@gmail.com} % % Copyright (c) 2021 by Oluwasegun Somefun . % MIT LICENSE % Permission is hereby granted, free of charge, to any person obtaining a copy of this software % and associated documentation files (the "Software"), to deal in the Software without restriction, % including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, % and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, % subject to the following conditions: % % The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. % % THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED % TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. % IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, % WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE % OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. % \typeout{**} \typeout{kblocks: A package to easily typeset Control Block Diagrams and Signal Flow Graphs with TikZ/PGF.} \typeout{(c) 2021. Oluwasegun Somefun} \typeout{*} \typeout{--Attention: The package has external dependency on TikZ/PGF.} \typeout{This package is covered with the MIT License.} \typeout{**} % Import Libraries \RequirePackage{tikz,circuitikz} \usepgflibrary{shapes.misc} \usetikzlibrary{math,calc,arrows,decorations.pathmorphing,decorations.markings, arrows.meta,backgrounds,fit,shadows,matrix,chains,scopes,positioning, decorations.pathreplacing,decorations.text,shapes.multipart,graphs,external} % Helpful \newcommand{\horizdist}{1.2cm} \newcommand{\sfghorizdist}{\horizdist*2} \newcommand{\verticdist}{1.2cm} \newcommand{\phasedist}{3.5cm} \newcommand{\minheight}{0.7cm} \newcommand{\textsize}{\footnotesize} \newcommand{\backgroundcolor}{white} \newcommand{\colortext}{black} \newcommand{\linecolor}{black} \newcommand{\dark}{0} \newcommand{\linetype}{very thick} \newcommand{\linepathtype}{semithick} \newcommand{\kmT}[1]{$\:\bm{#1}\:$} % block math text with 1 left-right border spacing \newcommand{\kmTw}[1]{$\:\:\: \bm{#1} \:\:\:$} %block math text with wider left-right border spacing \newcommand{\kShadow}{\renewcommand{\dark}{1}} \newcommand{\kColorB}[1]{\renewcommand{\backgroundcolor}{#1}} \newcommand{\kColorT}[1]{\renewcommand{\colortext}{#1}} \newcommand{\kColorL}[1]{\renewcommand{\linecolor}{#1}} \newcommand{\kScaleDistY}[1][1]{ \renewcommand{\verticdist}{1.2cm * #1} } \newcommand{\kScaleDistX}[1][1]{ \renewcommand{\horizdist}{1.5cm * #1} } % to add very very thick width for vector lines \tikzset{veclinetype/.style={line width=2.0pt}} % Global variables for Coordinate Calculations \newdimen\xc \newdimen\yc \newcommand*{\ExtractCoordinate}[1]{ \path (#1); \pgfgetlastxy{\xc}{\yc}; }% % Global styles \tikzset{every node/.style={anchor=center, text centered, align=center}} \tikzset{midarrow/.style={decoration={markings, mark=at position 0.5 with {\arrow{Latex[]}}},postaction={decorate}}} % DEDICATED ENVIRONMENT %% Usage: %\begin{kblock} % %\end{kblock} \newenvironment{kblock}{\begin{tikzpicture}\begin{scope}}{\end{scope}\end{tikzpicture}} % BLOCK DIAGRAM % Start Nodes \newcommand{\kStartNode}[2][]{ % name coordinate label \node (#2) {\color{\colortext}\textsize{#1}}; } \newcommand{\kStartNodec}[3][]{ \node (#3) at #2 {\color{\colortext}\textsize{#1}}; } % Area Cover Rectangle %% Usage [colour]{ref node}{north shift dimension}{south shift dimension}{west shift dimension}{east shift dimension} \newcommand{\kCoverRect}[6][black]{ \coordinate (centn) at (#2.north); \coordinate (cents) at (#2.south); \coordinate (cente) at (#2.east); \coordinate (centw) at (#2.west); \def\dn{#3}; \def\ds{#4}; \def\dw{#5}; \def\de{#6}; \ifx\dn\empty \def\dn{0}; \else \fi \ifx\ds\empty \def\ds{0}; \else \fi \ifx\dw\empty \def\dw{0}; \else \fi \ifx\de\empty \def\de{0}; \else \fi \newdimen\xn;% \newdimen\yn;% \path (centn); \pgfgetlastxy{\xn}{\yn}; \newdimen\xs;% \newdimen\ys;% \path (cents); \pgfgetlastxy{\xs}{\ys}; \newdimen\xw;% \newdimen\yw;% \path (centw); \pgfgetlastxy{\xw}{\yw}; \newdimen\xe;% \newdimen\ye;% \path (cente); \pgfgetlastxy{\xe}{\ye}; \newdimen\xonw;% \newdimen\xone;% \newdimen\xose;% \newdimen\xosw;% \newdimen\xon;% \newdimen\yon;% \newdimen\xos;% \newdimen\yos;% \tikzmath{ \xonw = \xw - \dw;% \xone = \xe + \de;% \xon = \xn;% \yon = \yn + \dn;% \xosw = \xw - \dw;% \xose = \xe + \de;% \xos = \xs;% \yos = \ys - \ds;% } \coordinate [label=] (BFitN) at ($(\xon,\yon)$); \coordinate [label=] (BFitS) at ($(\xos,\yos)$); \coordinate [label=] (BFitW) at ($(\xosw,\yw)$); \coordinate [label=] (BFitE) at ($(\xone,\ye)$); \coordinate [label=] (BFitNW) at ($(\xonw,\yon)$); \coordinate [label=] (BFitNE) at ($(\xone,\yon)$); \coordinate [label=] (BFitSW) at ($(\xosw,\yos)$); \coordinate [label=] (BFitSE) at ($(\xose,\yos)$); \begin{scope}[on background layer] \draw [color=#1, dashed] (BFitSW) -- (BFitSE) -- (BFitNE) -- (BFitNW) -- (BFitSW); \end{scope} } % Cover Text %% Usage: [optional shift dimension]{from node label}{to current tf node label}{tf text content} \newcommand{\kCoverTextRight}[5]{ \def\dxt{#1}; \def\dyt{#2}; \ifx\dxt\empty \def\dxt{0}; \else \fi \ifx\dyt\empty \def\dxt{0}; \else \fi \node [right of= BFitE, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kCoverTextLeft}[5]{ \def\dxt{#1}; \def\dyt{#2}; \ifx\dxt\empty \def\dxt{0}; \else \fi \ifx\dyt\empty \def\dxt{0}; \else \fi \node [left of= BFitW, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kCoverTextAbove}[5]{ \def\dxt{#1}; \def\dyt{#2}; \ifx\dxt\empty \def\dxt{0}; \else \fi \ifx\dyt\empty \def\dxt{0}; \else \fi \node [above of= BFitN, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kCoverTextBelow}[5]{ \def\dxt{#1}; \def\dyt{#2}; \ifx\dxt\empty \def\dxt{0}; \else \fi \ifx\dyt\empty \def\dxt{0}; \else \fi \node [below of= BFitS, node distance= 0.2cm, xshift= \dxt, yshift = \dyt, font=\textsize] (#3) {\color{\colortext}#4}; } % Arithmetic Summer Blocks %% Usage: {from node label}{to current sum node label}{optional horizontal position shift} % left down \newcommand{\kMinusPlusDown}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusDownL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusDownA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusDownB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusMinusDown}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusDownL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusDownA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusDownB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusDown}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusDownL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusDownA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusDownB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusPlusDown}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusDownL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusDownA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusDownB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusMinusDownPlaceAbove}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusDownPlaceBelow}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist + \dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } % left up \newcommand{\kMinusPlusUp}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusUpL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusUpA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusPlusUpB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kMinusMinusUp}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusUpL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusUpA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kMinusMinusUpB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusUp}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusUpB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusUpA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusUpL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusPlusUp}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusUpB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusUpA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusUpL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } % up down \newcommand{\kPlusDownPlusUp}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusDownPlusUpB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusDownPlusUpA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusDownPlusUpL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } % left up down \newcommand{\kPlusPlusMinus}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusPlusMinusB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusPlusMinusA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusPlusMinusL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusMinus}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusMinusL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusMinusA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusMinusB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; } \newcommand{\kPlusMinusPlus}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusMinusPlusB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusMinusPlusA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusMinusPlusL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$-$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusPlus}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, right of= #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, right of= #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusPlusL}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, left of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, left of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusPlusA}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, above of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, above of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } \newcommand{\kPlusPlusPlusB}[3]{ \def\dxpm{#3}; \ifx\dxpm\empty \def\dxpm{0}; \else \fi \node [draw=\linecolor, circle,minimum size=1.5em, below of = #1, node distance= \horizdist+\dxpm, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {}; \node [draw, cross out, minimum size=1.0em, below of = #1, node distance= \horizdist + \dxpm, thin, draw=black] {}; \node [left of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [above of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; \node [below of= #2, node distance = 0.45em] () { \color{\colortext}\tiny{$+$}}; } % Circular Gain Block \newcommand{\kGain}[4][]{ \node [draw=\linecolor, circle, right of= #1, node distance= \horizdist, minimum size = 1.5em, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) {\color{\colortext}#3}; } %% Rectangular TF Block %% Usage: %\kTF {current tf node label}[tf text content] %\kTFCs {coordinates}{current tf node label}[tf text content] \newcommand{\kTF}[2]{ \node [draw=\linecolor, rectangle, node distance= \horizdist, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#1) {\color{\colortext}#2}; } \newcommand{\kTFCs}[3]{ \node [draw=\linecolor, rectangle, node distance= \horizdist, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#2) at (#1) {\color{\colortext}#3}; } %% Usage: [optional shift dimension]{from node label}{to current tf node label}{tf text content} \newcommand{\kTFRight}[4][]{ \def\dxtf{#1}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, right of= #2, node distance= \horizdist + \dxtf, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kTFLeft}[4][]{ \def\dxtf{#1}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, left of= #2, node distance= \horizdist + \dxtf, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kTFAbove}[4][]{ \def\dytfb{#1}; \ifx\dytfb\empty \def\dytfb{0}; \else \fi \node [draw=\linecolor, rectangle, above of= #2, node distance= \verticdist + \dytfb, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#3) {\color{\colortext}#4}; } \newcommand{\kTFBelow}[4][]{ \def\dytfb{#1}; \ifx\dytfb\empty \def\dytfb{0}; \else \fi \node [draw=\linecolor, rectangle, below of= #2, node distance= \verticdist + \dytfb, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#3) {\color{\colortext}#4}; } %% Usage: {vertical shift dimension}{horizontal shift dimension}{from node label}{to current tf node label}{tf text content} % TF: Right % Above \newcommand{\kTFAboveRight}[5]{ \def\dytf{#1}; \ifx\dytf\empty \def\dytf{0}; \else \fi \def\dxtf{#2}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, above of= #3, node distance= 1.2cm + \dytf, xshift=1.2cm+\dxtf, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#4) {\color{\colortext}#5}; } % Line: Right Down \newcommand{\kTFBelowRight}[5]{ \def\dytf{#1}; \ifx\dytf\empty \def\dytf{0}; \else \fi \def\dxtf{#2}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, below of= #3, node distance= 1.2cm + \dytf, xshift=1.2cm+\dxtf, minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#4) {\color{\colortext}#5}; } % TF Left % Above \newcommand{\kTFAboveLeft}[5]{ \def\dytf{#1}; \ifx\dytf\empty \def\dytf{0}; \else \fi \def\dxtf{#2}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, above of= #3, node distance=1.2cm + \dytf, xshift=-(1.2cm+\dxtf), minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#4) {\color{\colortext}#5}; } % Below \newcommand{\kTFBelowLeft}[5]{ \def\dytf{#1}; \ifx\dytf\empty \def\dytf{0}; \else \fi \def\dxtf{#2}; \ifx\dxtf\empty \def\dxtf{0}; \else \fi \node [draw=\linecolor, rectangle, below of= #3, node distance=1.2cm + \dytf, xshift=-(1.2cm+\dxtf), minimum height = \minheight, \linetype, fill=\backgroundcolor, drop shadow={opacity=\dark}, font=\textsize] (#4) {\color{\colortext}#5}; } % Mark Visible Circular Nodes % Place Node with variable x-y coordinate shift %% Usage: {node x distance shift}{node y distance shift}{node text label}{from node label}{to current node label} % Place Node Left \newcommand{\kMarkNodeLeft}[5]{ \def\dxnlx{#1}; \def\dynly{#2}; \ifx\dxnlx\empty \def\dxnlx{0}; \else \fi \ifx\dynly\empty \def\dynly{0}; \else \fi \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of = #4, node distance= 1.2cm + \dxnlx, yshift=\dynly, label=\textsize{#3}] (#5) {}; } % Place Node Right \newcommand{\kMarkNodeRight}[5]{ \def\dxnrx{#1}; \def\dynry{#2}; \ifx\dxnrx\empty \def\dxnrx{0}; \else \fi \ifx\dynry\empty \def\dynry{0}; \else \fi \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of = #4, node distance= 1.2cm + \dxnrx, yshift=\dynry, label=\textsize{#3}] (#5) {}; } % Place Node Above \newcommand{\kMarkNodeAbove}[5]{ \def\dxnax{#1}; \def\dynay{#2}; \ifx\dxnax\empty \def\dxnax{0}; \else \fi \ifx\dynay\empty \def\dynay{0}; \else \fi \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of = #4, node distance= 1.2cm + \dxnax, yshift=\dynay, label=\textsize{#3}] (#5) {}; } % Place Node Below \newcommand{\kMarkNodeBelow}[5]{ \def\dxnbx{#1}; \def\dynby{#2}; \ifx\dxnbx\empty \def\dxnbx{0}; \else \fi \ifx\dynby\empty \def\dynby{0}; \else \fi \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of = #4, node distance= 1.2cm + \dxnbx, yshift=\dynby, label=\textsize{#3}] (#5) {}; } % Place Node At Coordinate %% Usage: {optional x distance shift}{optional y distance shift}{empty text-label}{current node coordinate} \newcommand{\kMarkNode}[4]{ \def\dxncsx{#1}; \def\dyncsy{#2}; \ifx\dxncsx\empty \def\dxncsx{0}; \else \fi \ifx\dyncsy\empty \def\dyncsy{0}; \else \fi \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.3em, node distance= 0cm + \dxncsx, yshift=\dyncsy, label=\textsize{#3}] (#4) {}; } % Place a Reference Invisible Node relative to other nodes %% Usage: [optional distance shift]{from node label}{to current coordinate label}{direction shift}{coordinate text label} \newcommand{\kJumpCSRight}[5][]{ \def\dxj{#1}; \ifx\dxj\empty \def\dxj{0}; \else \fi \coordinate (tmpn) at ($(#2.east) + (0,#4)$); \coordinate[right of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3); } \newcommand{\kJumpCSLeft}[5][]{ \def\dxj{#1}; \ifx\dxj\empty \def\dxj{0}; \else \fi \coordinate (tmpn) at ($(#2.west) + (0,#4)$); \coordinate[left of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3); } \newcommand{\kJumpCSAbove}[5][]{ \def\dxj{#1}; \ifx\dxj\empty \def\dxj{0}; \else \fi \coordinate (tmpn) at ($(#2.north) + (#4,0)$); \coordinate[above of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3); } \newcommand{\kJumpCSBelow}[5][]{ \def\dxj{#1}; \ifx\dxj\empty \def\dxj{0}; \else \fi \coordinate (tmpn) at ($(#2.south) + (#4,0)$); \coordinate[below of= tmpn, node distance= 1cm + \dxj, font=\textsize, label=\tiny{#5}] (#3); } % Place a Reference Invisible Node at any specific coordinate %% Usage: {current coordinate label}{coordinate (x,y)} \newcommand{\kJumpCS}[2][$(0,0)$]{ \coordinate (#2) at (#1); } % Links %% swap, near end,mid, add label text above lines or besides %% Usage: [optional signal label]{from node label}{to node label} % Link Left or Right, Up or Down \newcommand{\kLink}[3][]{ \draw [-latex,\linecolor, \linepathtype] (#2) -- node[auto] {\textsize{#1}} (#3); } % no arrow \newcommand{\kLinkn}[3][]{ \draw [\linecolor, \linepathtype] (#2) -- node[auto,above] {\textsize{#1}} (#3); } %% Vector link variant % Link Left or Right, Up or Down \newcommand{\kVecLink}[3][]{ \draw [-latex,\linecolor, veclinetype] (#2) -- node[auto] {\textsize{#1}} (#3); } % no arrow \newcommand{\kVecLinkn}[3][]{ \draw [\linecolor, veclinetype] (#2) -- node[auto,above] {\textsize{#1}} (#3); } %% Link Directed TODO: investigate use %% Usage: [optional signal link label]{from node label}{to node label}{from-to node direction shift} % Directed Link Left or Right, Up or Down \newcommand{\kLinkdir}[4][]{ \coordinate (tmp) at ($(#2.west) + (0,#4)$); \draw[-latex, \linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); } % no arrow \newcommand{\kLinkndir}[4][]{ \coordinate (tmp) at ($(#2.west) + (0,#4)$); \draw[\linecolor, \linepathtype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); } %% Vector link variant \newcommand{\kVecLinkdir}[4][]{ \coordinate (tmp) at ($(#2.west) + (0,#4)$); \draw[-latex, \linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); } % no arrow \newcommand{\kVecLinkndir}[4][]{ \coordinate (tmp) at ($(#2.west) + (0,#4)$); \draw[\linecolor, veclinetype] (tmp) -- node[auto] {\textsize{#1}} ($(#3.east) + (0,#4)$); } % Link Horizontal(Right or Left) Vertical(Up or Down) %% Usage: [optional link label]{from node label}{to current node label}{direction shift y}{direction shift x}{link label position} % Link: Left Up, Left Down, Right Up, Right Down \newcommand{\kLinkHV}[7][]{% TODO:DONE \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \def\dypos{#4}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \yt - \yf; if \asumxft>0 then {let \directn = south;} else { if \asumxft<0 then {let \directn = north;} else { let \directn = 0; }; }; \asumxft = \xt - \xf; if \asumxft>0 then {let \fdirectn = east;} else { if \asumxft<0 then {let \fdirectn = west;} else { let \fdirectn = 0; }; }; } % immediate marking of perpendicular edge of VH or HV links \def\mkpt{#7}; \ifx\mkpt\empty \else \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$); \newdimen\xtohat; \newdimen\ytohat;% \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat}; \coordinate (#7) at (\xf,\ytohat); % markpt coordinate %\coordinate (#1) at (\xf,\yt); % markpt coordinate \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {}; \fi % label positioning: 10 options (0 - 9) \def\poslabel{#6}; \ifx\poslabel\empty \def\poslabel{5}; \else \fi % integer register, count0 (0-255) \count0=\poslabel\relax; \ifnum\count0=0 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=1 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=2 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=3 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below, pos=0.3] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=4 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=5 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=6 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=7 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=8 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[left,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum\count0=9 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[right,pos=0.75] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi } %% vector variant \newcommand{\kVecLinkHV}[6][]{% TODO:extend changes made here to its other HV variants \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \def\dypos{#4}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \yt - \yf; if \asumxft>0 then {let \directn = south;} else { if \asumxft<0 then {let \directn = north;} else { let \directn = 0; }; }; \asumxft = \xt - \xf; if \asumxft>0 then {let \fdirectn = east;} else { if \asumxft<0 then {let \fdirectn = west;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=1 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=2 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=3 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=4 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=5 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=6 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=7 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=8 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi } %% No direction \newcommand{\kLinknHV}[6][]{% TODO:extend changes made here to its other HV variants \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \def\dypos{#4}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \yt - \yf; if \asumxft>0 then {let \directn = south;} else { if \asumxft<0 then {let \directn = north;} else { let \directn = 0; }; }; \asumxft = \xt - \xf; if \asumxft>0 then {let \fdirectn = east;} else { if \asumxft<0 then {let \fdirectn = west;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=1 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=2 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=3 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=4 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=5 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=6 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=7 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=8 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi % \def\mkpt{#5}; % \ifx\mkpt\empty % \else % \coordinate (#5) at (\xf,\yt); % markpt coordinate % \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xt,\yf) {}; % \fi } %% vector variant \newcommand{\kVecLinknHV}[6][]{% TODO:extend changes made here to its other HV variants \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \def\dypos{#4}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \yt - \yf; if \asumxft>0 then {let \directn = south;} else { if \asumxft<0 then {let \directn = north;} else { let \directn = 0; }; }; \asumxft = \xt - \xf; if \asumxft>0 then {let \fdirectn = east;} else { if \asumxft<0 then {let \fdirectn = west;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=1 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=2 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=3 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=4 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=5 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=6 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=7 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \ifnum#6=8 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[midway, below] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \else \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (0,\dypos)$) -| node[near end, above] {\textsize{#1}} ($(#3.\directn) + (\dxpos,0)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi } % Link Vertical(Up or Down) Horizontal(Right or Left) % Link Up Left, Up Right, Down Left, Down Right \newcommand{\kLinkVH}[7][]{ % TODO:DONE \def\dypos{#4}; \def\dxpos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \xt - \xf; if \asumxft>0 then {let \directn = west;} else { if \asumxft<0 then {let \directn = east;} else { let \directn = 0; }; }; \asumyft = \yt - \yf; if \asumyft>0 then {let \fdirectn = north;} else { if \asumyft<0 then {let \fdirectn = south;} else { let \fdirectn = 0; }; }; } % immediate marking of perpendicular edge of VH or HV links \def\mkpt{#7}; \ifx\mkpt\empty \else \coordinate (hat3) at ($(#3.\directn) + (0,\dypos)$); \newdimen\xtohat; \newdimen\ytohat;% \path (hat3); \pgfgetlastxy{\xtohat}{\ytohat}; \coordinate (#7) at (\xf,\ytohat); % markpt coordinate %\coordinate (#1) at (\xf,\yt); % markpt coordinate \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=0.3em] at (\xf,\ytohat) {}; \fi % label positioning: 10 options (0 - 9) \def\poslabel{#6}; \ifx\poslabel\empty \def\poslabel{5}; \else \fi % integer register, count0 (0-255) \count0=\poslabel\relax; \ifnum\count0=0 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=1 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right, pos=0.15] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=2 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[left,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=3 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[right,pos=0.3] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=4 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=5 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=6 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below left,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=7 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=8 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum\count0=9 \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[below, pos=0.75] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \draw[-latex, \linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[above right,pos=0.5] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi } %% vector variant \newcommand{\kVecLinkVH}[6][]{ % TODO:extend changes made here to its other VH variants \def\dypos{#4}; \def\dxpos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \xt - \xf; if \asumxft>0 then {let \directn = west;} else { if \asumxft<0 then {let \directn = east;} else { let \directn = 0; }; }; \asumyft = \yt - \yf; if \asumyft>0 then {let \fdirectn = north;} else { if \asumyft<0 then {let \fdirectn = south;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=1 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=2 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=3 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=4 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=5 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=6 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=7 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=8 \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \draw[-latex, \linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi } %% No Direction \newcommand{\kLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants \def\dypos{#4}; \def\dxpos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \xt - \xf; if \asumxft>0 then {let \directn = west;} else { if \asumxft<0 then {let \directn = east;} else { let \directn = 0; }; }; \asumyft = \yt - \yf; if \asumyft>0 then {let \fdirectn = north;} else { if \asumyft<0 then {let \fdirectn = south;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=1 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=2 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=3 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=4 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=5 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=6 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=7 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=8 \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \draw[\linecolor, \linepathtype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi } %% vector variant \newcommand{\kVecLinknVH}[6][]{ % TODO:extend changes made here to its other VH variants \def\dypos{#4}; \def\dxpos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (fromn) at (#2);% from node coordinate \coordinate (ton) at (#3);% to node coordinate % extract x and y coordinates \newdimen\xf;% \newdimen\yf;% \path (fromn); \pgfgetlastxy{\xf}{\yf}; \newdimen\xt;% \newdimen\yt;% \path (ton); \pgfgetlastxy{\xt}{\yt}; \newdimen\asumxft; \tikzmath{ \asumxft = \xt - \xf; if \asumxft>0 then {let \directn = west;} else { if \asumxft<0 then {let \directn = east;} else { let \directn = 0; }; }; \asumyft = \yt - \yf; if \asumyft>0 then {let \fdirectn = north;} else { if \asumyft<0 then {let \fdirectn = south;} else { let \fdirectn = 0; }; }; } \ifnum#6=0 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=1 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=2 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=3 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[near end, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=4 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=5 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=6 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, above left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=7 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below right] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \ifnum#6=8 \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[midway, below left] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \else \draw[\linecolor, veclinetype] ($(#2.\fdirectn) + (\dxpos,0)$) |- node[auto, above] {\textsize{#1}} ($(#3.\directn) + (0,\dypos)$); \fi \fi \fi \fi \fi \fi \fi \fi \fi } % Link Full Feedback/FeedForward Horizontal(Right or Left) to Vertical(Up or Down) % to Horizontal(Right or Left) %% Usage: [optional link scale]{link label}{from node}{to node}{from node direction shift}{to node direction shift} \newcommand{\kLinkHVHRight}[6][]{ \def\dxr{#1}; \ifx\dxr\empty \def\dxr{0}; \else \fi \coordinate (tmplr) at ($(#3.east) + (0,#5)$); \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$); \draw[-latex, \linecolor, \linepathtype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$); } % vector \newcommand{\kVLinkHVHRight}[6][]{ \def\dxr{#1}; \ifx\dxr\empty \def\dxr{0}; \else \fi \coordinate (tmplr) at ($(#3.east) + (0,#5)$); \coordinate (tmp) at ($(#3.east) + (0,#5) + (0.33+\dxr,0)$); \draw[-latex, \linecolor, veclinetype] (tmplr) -| (tmp) node[at end, below right] {\textsize{#2}} |-($(#4.east) + (0,#6)$); } \newcommand{\kLinkHVHLeft}[6][]{ \def\dxl{#1}; \ifx\dxl\empty \def\dxl{0}; \else \fi \coordinate (tmpll) at ($(#3.west) + (0,#5)$); \coordinate (tmp) at ($(#3.west) + (0,#5) + (-0.33-\dxl,0)$); \draw[-latex, \linecolor, \linepathtype] (tmpll) -| (tmp) node[at end, above left] {\textsize{#2}} |- ($(#4.west) + (0,#6)$); } % Link Full Feedback/FeedForward Vertical(Up or Down) to Horizontal(Right or Left) to Vertical(Up or Down) %% Usage: {optional link shift}{unity link label}{from node}{to node}{from node direction shift}{to node direction shift} % Above \newcommand{\kLinkVHHVAbove}[6][]{ \def\dxb{#1}; \ifx\dxb\empty \def\dxb{0}; \else \fi \coordinate (tmpb) at ($(#3.north) + (#5,0)$); \coordinate (tmpc) at ($(#4.north) + (#6,0)$); \newdimen\xca; \newdimen\yca; \path (tmpb); \pgfgetlastxy{\xca}{\yca}; \newdimen\xcb; \newdimen\ycb; \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; \newdimen\xcr; \tikzmath{ \xcr = 0.5 * (\xca+\xcb); } \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$); } % Below \newcommand{\kLinkVHHVBelow}[6][]{ \def\dxb{#1}; \ifx\dxb\empty \def\dxb{0}; \else \fi \coordinate (tmpb) at ($(#3.south) + (#5,0)$); \coordinate (tmpc) at ($(#4.south) + (#6,0)$); \newdimen\xca; \newdimen\yca; \path (tmpb); \pgfgetlastxy{\xca}{\yca}; \newdimen\xcb; \newdimen\ycb; \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; \newdimen\xcr; \tikzmath{ \xcr = 0.5 * (\xca+\xcb); } \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,-1cm-\dxb) $); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$); } % No directions % Above \newcommand{\kLinknVHHVAbove}[6][]{ \def\dxb{#1}; \ifx\dxb\empty \def\dxb{0}; \else \fi \coordinate (tmpb) at ($(#3.north) + (#5,0)$); \coordinate (tmpc) at ($(#4.north) + (#6,0)$); \newdimen\xca; \newdimen\yca; \path (tmpb); \pgfgetlastxy{\xca}{\yca}; \newdimen\xcb; \newdimen\ycb; \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; \newdimen\xcr; \tikzmath{ \xcr = 0.5 * (\xca+\xcb); } \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,1cm-\dxb) $); \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.north) + (#6,0)$); } % Below \newcommand{\kLinknVHHVBelow}[6][]{ \def\dxb{#1}; \ifx\dxb\empty \def\dxb{0}; \else \fi \coordinate (tmpb) at ($(#3.south) + (#5,0)$); \coordinate (tmpc) at ($(#4.south) + (#6,0)$); \newdimen\xca; \newdimen\yca; \path (tmpb); \pgfgetlastxy{\xca}{\yca}; \newdimen\xcb; \newdimen\ycb; \path (tmpc); \pgfgetlastxy{\xcb}{\ycb}; \newdimen\xcr; \tikzmath{ \xcr = 0.5 * (\xca+\xcb); } \coordinate [label=\tiny{#2}] (tmp) at ($ (\xcr,\yca) + (0,-1cm-\dxb) $); \draw [\linecolor, \linepathtype] (tmpb) |- (tmp) -| ($(#4.south) + (#6,0)$); } % Link Feedback/FeedForward with a TF Block in between %% Usage: {signal label before tf}{signal label after tf}{from node}{tf node}{to node}{from node direction shift}{tf direction shift}{to node direction shift} \newcommand{\kLinkVHTFHVBelow}[8]{ \coordinate (tmpb) at ($(#3.south) + (#6,0)$); \coordinate (tmpu) at ($(#4.east) + (0,#7)$); \coordinate (tmpv) at ($(#4.west) + (0,#7)$); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu); \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.south) + (#8,0)$); } \newcommand{\kLinkVHTFHVBelowRight}[8]{ \coordinate (tmpb) at ($(#3.south) + (#6,0)$); \coordinate (tmpu) at ($(#4.west) + (0,#7)$); \coordinate (tmpv) at ($(#4.east) + (0,#7)$); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu); \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.south) + (#8,0)$); } \newcommand{\kLinkVHTFHVAbove}[8]{ \coordinate (tmpb) at ($(#3.north) + (#6,0)$); \coordinate (tmpu) at ($(#4.east) + (0,#7)$); \coordinate (tmpv) at ($(#4.west) + (0,#7)$); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu); \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.north) + (#8,0)$); } \newcommand{\kLinkVHTFHVAboveRight}[8]{ \coordinate (tmpb) at ($(#3.north) + (#6,0)$); \coordinate (tmpu) at ($(#4.west) + (0,#7)$); \coordinate (tmpv) at ($(#4.east) + (0,#7)$); \draw [-latex,\linecolor, \linepathtype] (tmpb) |- node[auto,above left] {\textsize{#1}} (tmpu); \draw [-latex,\linecolor, \linepathtype] (tmpv) -| node[auto,above left] {\textsize{#2}} ($(#5.north) + (#8,0)$); } % Cross Links \newcommand{\kLinkCrossLeftAbove}[2]{ \coordinate [above of=#1, node distance= \verticdist, xshift=-\horizdist] (tmp); \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(-\horizdist/2,0) -- ($(#2)-(0,\verticdist)$) -- (#2); } \newcommand{\kLinkCrossLeftBelow}[2]{ \coordinate [below of=#1, node distance= \verticdist, xshift=-\horizdist] (tmp); \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(-\horizdist/2,0) -- ($(#2)+(0,\verticdist)$) -- (#2); } \newcommand{\kLinkCrossRightAbove}[2]{ \coordinate [above of=#1, node distance= \verticdist, xshift=\horizdist] (tmp); \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(\horizdist/2,0) -- ($(#2)-(0,\verticdist)$) -- (#2); } \newcommand{\kLinkCrossRightBelow}[2]{ \coordinate [below of=#1, node distance= \verticdist, xshift=\horizdist] (tmp); \draw[-latex, \linecolor, \linepathtype] (#1)|-(tmp) -- ++(\horizdist/2,0) -- ($(#2)+(0,\verticdist)$) -- (#2); } % Link Inputs and Outputs Invisible Node %% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift} % Marked Link Inputs and Outputs Visible Node %% Usage: [optional distance shift]{from node label}{to current node label}{in label}{direction}{direction shift}{label position} % Inputs \newcommand{\kInRight}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn); } \newcommand{\kInLeft}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn); } \newcommand{\kInUp}[5][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn); } \newcommand{\kInDown}[5][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); \node[below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (#3)--(tmpn); } % Marked (visible node) Link Inputs \newcommand{\kInLeftM}[6][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); } \newcommand{\kInRightM}[6][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); } \newcommand{\kInUpM}[6][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi % to add to all \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize, label=above:\color{\colortext}{#4}] (#3) {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); } \newcommand{\kInDownM}[6][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi % to add to all \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (#3) -- (tmpn); } % Outputs \newcommand{\kOutRight}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.east) + (0,#5)$); \node[right of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3); } \newcommand{\kOutLeft}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.west) + (0,#5)$); \node[left of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3); } \newcommand{\kOutUp}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.north) + (#5,0)$); \node[above of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3); } \newcommand{\kOutDown}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.south) + (#5,0)$); \node[below of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, \linepathtype] (tmpo)--(#3); } % Marked (visible node) Link Outputs (Redundant): To Remove this \newcommand{\kOutLeftM}[6][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); } \newcommand{\kOutRightM}[6][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.east) + (0,\dypos)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); } \newcommand{\kOutUpM}[6][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi % to add to all \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.north) + (\dxpos,0)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, above of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); } \newcommand{\kOutDownM}[6][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi % to add to all \def\dxpos{#5}; \ifx\dxpos\empty \def\dxpos{0}; \else \fi \coordinate (tmpn) at ($(#2.south) + (\dxpos,0)$); \ifnum#6=0 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \else \ifnum#6=1 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above left:\color{\colortext}{#4}] {}; \else \ifnum#6=2 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above right:\color{\colortext}{#4}] {}; % \else \ifnum#6=3 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below:\color{\colortext}{#4}] {}; \else \ifnum#6=4 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below left:\color{\colortext}{#4}] {}; \else \ifnum#6=5 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=below right:\color{\colortext}{#4}] {}; % \else \ifnum#6=6 \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=left:\color{\colortext}{#4}] {}; \else \node[fill=\linecolor, circle, inner sep=0pt, outer sep=0pt, minimum size=0.3em, below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) [label=above:\color{\colortext}{#4}] {}; \fi \fi \fi \fi \fi \fi \fi % \draw[-latex, \linecolor, \linepathtype] (tmpn) -- (#3); } %% Vector variants \newcommand{\kVecInRight}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi \coordinate (tmpn) at ($(#2.east) + (0,#5)$); \node[right of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); } \newcommand{\kVecInLeft}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi % to add to all \def\dypos{#5}; \ifx\dypos\empty \def\dypos{0}; \else \fi \coordinate (tmpn) at ($(#2.west) + (0,\dypos)$); \node[left of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); } \newcommand{\kVecInUp}[5][]{ \def\dxina{#1}; \ifx\dxina\empty \def\dxina{0}; \else \fi \coordinate (tmpn) at ($(#2.north) + (#5,0)$); \node[above of= tmpn, node distance= 1.2cm + \dxina, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); } \newcommand{\kVecInDown}[5][]{ \def\dxinr{#1}; \ifx\dxinr\empty \def\dxinr{0}; \else \fi \coordinate (tmpn) at ($(#2.south) + (#5,0)$); \node[below of= tmpn, node distance= 1.2cm + \dxinr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (#3)--(tmpn); } % Link Outputs Invisible Node %% Usage: [optional distance shift]{from node label}{to current node label}{out signal label}{direction shift} \newcommand{\kVecOutRight}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.east) + (0,#5)$); \node[right of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); } \newcommand{\kVecOutLeft}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.west) + (0,#5)$); \node[left of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); } \newcommand{\kVecOutUp}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.north) + (#5,0)$); \node[above of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); } \newcommand{\kVecOutDown}[5][]{ \def\dxoutr{#1}; \ifx\dxoutr\empty \def\dxoutr{0}; \else \fi \coordinate (tmpo) at ($(#2.south) + (#5,0)$); \node[below of= tmpo, node distance= 1.2cm + \dxoutr, font=\textsize] (#3) {\color{\colortext}#4}; \draw[-latex, \linecolor, veclinetype] (tmpo)--(#3); } % ---------------------------------------------------------------------------------------- % SIGNAL FLOW GRAPHS \newcommand{\ksfgStart}[3]{ \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em, node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {}; } \newcommand{\ksfgNStart}[3]{ \node[draw,circle,fill=\linecolor,inner sep=0pt, outer sep=0pt, minimum size=0.5em, node distance= \horizdist,label=below:\color{\colortext}\textsize{#3}] (#1) at #2 {}; } \newcommand{\ksfgNodeR}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, right of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } \newcommand{\ksfgNodeL}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, left of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } \newcommand{\ksfgNodeU}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, above of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } \newcommand{\ksfgNodeD}[5][]{ \node[fill=\linecolor,circle,inner sep=0pt, outer sep=0pt, minimum size=.5em, below of = #2, node distance= \sfghorizdist,label=#5:\color{\colortext}\textsize{#4}] (#3) {}; \draw [\linecolor, \linepathtype, midarrow] (#2)-- node[auto,above] {\textsize{#1}} (#3); } \newcommand{\ksfgLinkSelfR}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [out=45,in=-45] node[right] {\textsize{#1}} (#2); } \newcommand{\ksfgLinkSelfL}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [out=-135,in=-135] node[left] {\textsize{#1}} (#2); } \newcommand{\ksfgLinkSelfU}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [in=45,out=135] node[above] {\textsize{#1}} (#2); } \newcommand{\ksfgLinkSelfD}[2][]{ \draw[\linecolor, \linepathtype, midarrow,looseness=50] (#2) to [in=225,out=315] node[below] {\textsize{#1}} (#2); } \newcommand{\ksfgCLinkFlip}[4][]{ \draw[midarrow, bend right=60] (#2) to node[#4] {\textsize{#1}} (#3); } \newcommand{\ksfgCLink}[4][]{ \draw[midarrow, bend left=60] (#2) to node[#4] {\textsize{#1}} (#3); } %% node label positioning: at start near start midway near end at end, above below, sloped