![如何用 circuitikz 绘制 8 选 1 多路复用器](https://linux22.com/image/291306/%E5%A6%82%E4%BD%95%E7%94%A8%20circuitikz%20%E7%BB%98%E5%88%B6%208%20%E9%80%89%201%20%E5%A4%9A%E8%B7%AF%E5%A4%8D%E7%94%A8%E5%99%A8.png)
如何绘制一个带 或tikz
的8 选 1 多路复用器circuitikz
?下面显示了手绘示例。
答案1
使用 TiKz:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw (0,0)coordinate (O)--++(30:1)coordinate (A)--++(90:4)coordinate (B)--++(150:1)coordinate (C)--cycle;
\draw ($(A)!0.5!(B)$)--++(0:1)node[right]{$F$};
\draw ($(O)!0.5!(A)$)--++(-90:1)--++(180:2)node[left]{$b$};
\draw ($(O)!0.25!(A)$)--++(-90:0.5)--++(180:1.75)node[left]{$a$};
\draw ($(O)!0.75!(A)$)--++(-90:1.5)--++(180:2.25)node[left]{$c$};
\foreach \y/\t in {0.1/1,0.2/2,0.3/3,0.4/4,0.5/5,0.6/6,0.7/7,0.8/8} {
\draw ($(C)! \y*1.1 !(O)$)--++(180:1) node[left] {$X \t$};}
\end{tikzpicture}
\end{document}
答案2
该circuits.logic.IEC
库提供了一个and gate
可为您提供所需数量的输入锚点:
\documentclass{article}
\usepackage{circuitikz}
\usetikzlibrary{circuits.logic.IEC,calc}
\begin{document}
\begin{circuitikz}[circuit logic IEC]
\node[and gate,inputs={nnnnnnnn},and gate IEC symbol={},text height=3cm,
] (A) {};
\foreach \Valor in {1,...,8}
{
\draw ([xshift=-10pt]A.input \Valor) node[left] {$I_{\Valor}$} -- (A.input \Valor);
}
\draw (A.output) -- ++(10pt,0) node[right] {$F$};
\draw ( $ (A.south west)!0.25!(A.south east) $ ) -- ++(-90:0.25) |- ++(-10pt,0) node[left] {$a$};
\draw (A.south) -- ++(-90:0.5) |- ++(-15pt,0) node[left] {$b$};
\draw ( $ (A.south west)!0.75!(A.south east) $ ) -- ++(-90:0.75) |- ++(-20pt,0) node[left] {$c$};
\end{circuitikz}
\end{document}