I'm currently learning how to use Tikz and was looking into drawing automata (specifically Simulink-like state models). Currently, I'm making a style that should reduce my efforts to a minimum when drawing these state models. Unfortunately, I can't seem to figure out how to do the following:
To draw two lines relatively to all nodes that use a certain style (in this case Ramp).
This is what I have currently:
\documentclass[preview]{standalone}
\usepackage[dutch]{babel}
\usepackage{mathtools}
\usepackage{mathdots}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{automata}
\usetikzlibrary{arrows}
\begin{document}
\tikzstyle{colorful} = [fill=gray!10]
\tikzstyle{block} = [draw, colorful, rectangle, minimum height=3em, minimum width=3em]
\tikzstyle{ramp} = [block, pin={below:Ramp}]
\tikzstyle{sum} = [draw, colorful, circle, node distance=1cm]
\tikzstyle{gain} = [draw, colorful, regular polygon, regular polygon sides=3, shape border rotate=30]
\tikzstyle{integrator} = [block, right=of gain, pin={below:Integrator}]%, node contents = $\frac{1}{s}$]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{node} = [coordinate]
\tikzset{every pin/.style={pin distance = 1mm}}
\tikzset{every pin edge/.style={draw=none}}
\begin{tikzpicture}[auto, node distance=1cm,>=latex']
\node [ramp] at (0,0) (input) {};
\node [block, right=of input] (prod) {$\times$};
\node [gain, right=of prod] (gain) {$-1$};
\node [integrator] (system) {$\frac{1}{s}$};
\node [output, right=of system] (output) {};
\draw [draw,->] (gain) -- node [name=dy] {$\dot{y}$} (system);
\draw [draw,->] (system) -- node [name=y] {$y$} (output);
\draw [draw,->] (input) -- node {$t$} (prod);
\draw [draw,->] (prod) -- node {} (gain);
\node [node, below=of y] (node1) {};
\node [node, below=of prod] (node2) {};
\draw [->] (y) |- (node1) |- (node2) -- (prod);
\draw (-1/3,-1/3) -- (-1/10,-1/3) -- (1/3,1/3);
% \draw (-1/3,-1/3) -- ++(7/30,0) -- ++(13/30,2/3);
\end{tikzpicture}
\end{document}
Either of the lines on the bottom should be drawn relative to every node of style Ramp.
Best Answer
Here are two examples how you can draw in a node using style :
EDIT: In your concrete example you can add the following style
And then use it for example in
ramp
style like this :