2

I am using signalflowdiagram from here: http://www.texample.net/tikz/examples/signal-flow-building-blocks/. Then I installed it in my texmf-local folder. The tree looks like this:

/usr/local/texlive/texmf-local
tex
├── latex
│   ├── local
│   ├── signalflowlibrary
│   │   ├── macros.sty
│   │   ├── signalflowdiagram.sty
│   │   ├── tikzlibrarysignalflowarrows.code.tex
│   │   ├── tikzlibrarysignalflowblocks.code.tex
│   │   ├── tikzlibrarysignalflowdiagram.code.tex
│   │   └── tikzlibrarysignalflowoperators.code.tex
...

After copying the necessary files to the tree as shown above, I ran $ mktexlsr to make sure LaTeX can find the new custom package.

I can confirm that it works properly because this code:

\documentclass[crop,tikz]{standalone}
\usepackage{signalflowdiagram}

\begin{document}
  \begin{signalflow}{Block diagram}
    \begin{scope}
      \node[input] (in) {$R(s)$};
      \node[filter] (plant) [right from=in] {$G(s)$};
      \path[r>] (in) -- (plant);
    \end{scope}
  \end{signalflow}
\end{document}

produces this picture:

enter image description here

The problem

Now I want to position the nodes using \matrix. First, I will show that I can get \matrix to work, nothing fancy:

\documentclass[crop,tikz]{standalone}
\usepackage{tikz}
%\usepackage{signalflowdiagram}
\usetikzlibrary{matrix}

\begin{document}
  \begin{tikzpicture}
  \matrix (m) [matrix of nodes]
  {%
    1 & 2 & 3 \\
    4 & 5 & 6 \\
  };
  \end{tikzpicture}
\end{document}

So I get this:

enter image description here

This time, I want to use the predefined blocks in signalflowdiagram, so I uncomment the line that says \usepackage{signalflowdiagram}. My code now looks like this. Notice the use of signalflow and scope environments as shown in the first example above.

\documentclass[crop,tikz]{standalone}
\usepackage{tikz}
\usepackage{signalflowdiagram}
\usetikzlibrary{matrix}

\begin{document}
  \begin{signalflow}{Block diagram}
    \begin{scope}
      \matrix (m) [matrix of nodes]
      {%
        1 & 2 & 3 \\
        4 & 5 & 6 \\
      };
    \end{scope}
  \end{signalflow}
\end{document}

Nothing appears :o I have not even started using the predefined blocks in signalflowdiagram.

enter image description here

Even using an ordinary tikzpicture draws nothing:

\documentclass[crop,tikz]{standalone}
\usepackage{tikz}
\usepackage{signalflowdiagram}
\usetikzlibrary{matrix}

\begin{document}
  \begin{tikzpicture}
    \matrix (m) [matrix of nodes]
    {%
      1 & 2 & 3 \\
      4 & 5 & 6 \\
    };
  \end{tikzpicture}
\end{document}

The common denominator

As long as \usepackage{signalflowdiagram} is present, all \matrix disappear.

Is there a way to get signalflowdiagram to work with \matrix? I did try hacking into the signalflowdiagram code files, disabling definition of new environments, etc., to no avail.

  • 2
    I just looked at the style file and found that the main environment signalflow nests tikzpictures. For me, this is enough reason not to use that package. This suggests that the issues you are reporting may only be fixed by rewriting the style file and its libraries. – marmot Dec 2 '18 at 12:07
1

Per @marmot's comment, the style file itself is unwieldy. So I hacked it myself here: https://github.com/kitmonisit/signalflow

I'll quote the included example:

\documentclass[crop,tikz]{standalone}
\usepackage{signalflowdiagram}
\usetikzlibrary{matrix}

\begin{document}
  \begin{tikzpicture}
    [every node/.style={anchor=center}]
    \matrix (m) [matrix of nodes,
      minimum width=7.5in,
      row sep=10mm,
      column sep=16mm]
    {%
      % row 0
      \node[input] (in)    {$R(s)$}; &
      \node[adder] (add)   {};       &
      \node[block] (plant) {$G(s)$}; &
      \node[node]  (tap)   {};       &
      \node[output](out)   {$C(s)$}; \\
      % row 1
      &
      &
      \node[block] (fb)    {$H(s)$}; &
      &
      & \\
    };

    \path[r>] (in) -- (add);
    \path[r>] (add) -- (plant);
    \path[r]  (plant) -- (tap);
    \path[r>] (tap) -- (out);
    \path[r>] (tap) |- (fb);
    \path[r>] (fb) -| (add);
  \end{tikzpicture}
\end{document}

signal flow diagram

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.