2

I want to be able to create a node that has anchors on the sides as well as on the top and bottom like in the block labelled "555 Astable" in the following picture (credits):

enter image description here

The dipchip node in the circuitikz package is the closest thing I could find but it does not have pins on the top and bottom. If I were to use a simple rectangle node then I would have to hardcode the positions, which I am trying to avoid. Any thoughts ?

1
  • 1
    You can use a mux-demux with equal sizes for in and out side. They are completely configurable
    – Rmano
    Commented May 9, 2021 at 7:46

1 Answer 1

7

For this kind of personalized things, use muxdemuxes class. It is highly configurable. For example:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}[]
    \tikzset{ic555/.style={muxdemux,
            muxdemux def={Lh=10, NL=5, Rh=10, NR=5,
            NB=2, w=6, NT=2, square pins=1},
        no input leads, external pins width=0.4,
        circuitikz/muxdemuxes/fill=blue!10}
    }
    \node [ic555, font=\small\ttfamily,align=center](A) at (0,0) {555\\Astable};
    % left pins
    \foreach \rawpin/\npin/\label in {2/7/Discharge, 4/2/Trigger, 5/6/Threshold} {
        \draw (A.lpin \rawpin) -- (A.blpin \rawpin)
            node[midway, blue, font=\small, above]{\npin}
            node[right, font=\small]{\label};
    }
    % top pins
    \foreach \rawpin/\npin in {1/8, 2/4} {
        \draw (A.tpin \rawpin) -- (A.btpin \rawpin)
            node[midway, blue, font=\small, left]{\npin};
    }
    % bottom pins
    \foreach \rawpin/\npin in {1/5, 2/1} {
        \draw (A.bpin \rawpin) -- (A.bbpin \rawpin)
            node[midway, blue, font=\small, left]{\npin};
    }
    % finally, left
    \draw (A.rpin 3) -- (A.brpin 3) node[midway, blue, font=\small, above]{3};
\end{tikzpicture}
\end{document}

Gives you this:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .