# [Tex/LaTex] How to draw saturation symbol inside a node in TikZ

tikz-pgf

I'm working on a block diagram using TikZ. I'd like to create a symbol like below, which means I have to draw 5 lines inside a node and write a letter in the upper-right corner.

What's the best way to achieve what I need? Any hints appreciated.

#### Best Answer

Here is a possible implementation (based on Automat within Record). Is this what you had in mind?

\documentclass{article}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}

\newcounter{image}
\setcounter{image}{0}

\pgfmathtruncatemacro{\recordwidth}{2}
\pgfmathtruncatemacro{\recordheight}{1}

\newcommand{\setrecordwidth}[1]{\pgfmathtruncatemacro{\recordwidth}{#1}}
\newcommand{\setrecordheight}[1]{\pgfmathtruncatemacro{\recordheight}{#1}}

\newcommand{\mylabel}{M}
\newcommand{\labelfont}{\scriptsize}

\tikzset{drawinside/.code args={#1}{%
\draw($(#1.west)!0.3!(#1.center)$)--($(#1.east)!0.3!(#1.center)$);
\draw($(#1.south)!0.3!(#1.center)$)--($(#1.north)!0.3!(#1.center)$);
\draw($(#1.south west)!0.4!(#1.west)!0.3!(#1.center)$)--($(#1.south west)!0.165!(#1.west)!0.5!(#1.center)$)--(#1.center);
\draw(#1.center)--($(#1.north east)!0.165!(#1.east)!0.65!(#1.center)$)--($(#1.north east)!0.45!(#1.east)!0.45!(#1.center)$) node[right,font=\labelfont]{$\mylabel$};
}
}

\tikzset{record/.style args={#1 and #2}{
rectangle,draw,minimum width=#1, minimum height=#2
}
}

\NewDocumentCommand{\drawrecord}{d()}{
\stepcounter{image}
\IfNoValueTF{#1}{%true
\node[record=\recordwidth cm and \recordheight cm,name=a\theimage]{};
}
{%false
\node[record=\recordwidth cm and \recordheight cm,name=a\theimage]at(#1){};
}
\node[drawinside={a\theimage}]{};
}

\begin{document}
\tikz{\drawrecord}
\tikz{\drawrecord}

\vspace*{2cm}
\begin{tikzpicture}
\drawrecord(0,0)
\setlabel{X}
\setlabelfont{\normalfont}
\setrecordwidth{6}
\setrecordheight{3}
\drawrecord(6,0) % that's the 4° picture, so it can be accessed by (a4)
\draw[-stealth]($(a4.west)+(-1,0)$)--(a4.west);
\draw[-stealth](a4.east)--($(a4.east)+(1,0)$);
\end{tikzpicture}
\end{document}


It allows you to customize the dimensions of the block and the labels. Moreover, as did for the last block, you can connect this with the rest of the picture by means of (anumber of the picture).