我希望能够创建一个在侧面以及顶部和底部都有锚点的节点,就像下图中标有“555 Astable”的块一样(学分):
circuitikz 封装中的节点dipchip
是我能找到的最接近的节点,但它的顶部和底部没有引脚。如果我使用一个简单的矩形节点,那么我必须对位置进行硬编码,而这正是我试图避免的。有什么想法吗?
答案1
对于这种个性化的东西,使用muxdemuxes
类。它具有高度可配置性。例如:
\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}
给你这个: