如何在 Circuitikz 中反转逻辑门输入

如何在 Circuitikz 中反转逻辑门输入

我画了下面的电路,但是逻辑门的输入怎么才能反转呢?(就像扫描的图片一样,但具体是哪个门并不重要,只是一般而言)

电路

否定输入

\documentclass[a4paper,12pt]{article}

\usepackage{tikz} %vectorgraphics
\usetikzlibrary{shapes,arrows,shadows,
decorations.pathreplacing,backgrounds,calc} 
%graph/flowchart
\usepackage[siunitx]{circuitikz}

\begin{document}
\begin{circuitikz} \draw

(0,0) node[nand port] (nand1) {}
(3,0) node[nand port] (nand2) {}
(5,0) node[nand port] (nand3) {}

(3,2) node[nand port] (nand4) {}
(5,2) node[nand port] (nand5) {}

(3,4) node[nand port] (nand6) {}
(5,4) node[nand port] (nand7) {}

(0,4) node[nand port] (nand8) {}

(nand1.out) |- (nand2.in 2)
(nand2.out) -| node[circ,midway]{} (nand3.in 1)
(nand2.out) -| (nand3.in 2)

(nand8.out) |- (nand6.in 1)
(nand6.out) -| node[circ,midway]{} (nand7.in 2)
(nand6.out) -| (nand7.in 1)

(nand4.out) -| node[circ,midway]{} (nand5.in 2)
(nand4.out) -| (nand5.in 1)

(-2,1) node(B1)[anchor=east] {B}
(-2,1) -| node[circ,midway]{} (nand1.in 1) 
to[short,*-] (nand1.in 2)
(-2,1) -| (nand4.in 2)
(1,1) node[circ]{} |- (nand6.in 2)


(-2,3) node[anchor=east] {A}
(-2,3) -| node[circ,midway]{} (nand8.in 2) 
to[short,*-] (nand8.in 1)
(-2,3) -| (nand4.in 1)
(0.5,3) node[circ]{} |- (nand2.in 1)

(6,1.97) node[anchor=east] {O2}
(6,0.0) node[anchor=east] {O3}
(6,4) node[anchor=east] {O1}

;\end{circuitikz}

\end{document}

答案1

使用全新的circuitikzgit 几分钟前上传,你现在可以这样做:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikzgit}
\begin{document}
\begin{circuitikz}
    \draw (0,3) node[american and port] (A)  {P1};
    \node at (A.bin 1) [ocirc, left]{} ;
    \begin{scope}
        \ctikzset{tripoles/american or port/height=1.6}
        \draw (A.out) -- ++(0.5,0) node[american or port,
        number inputs=5, anchor=in 1] (B)  {P2};
        \node at (B.bin 3) [ocirc, left]{} ;
    \end{scope}
    \draw (0,1.5) node[american or port] (C)  {P3};
    \node at (C.bin 2) [ocirc, left]{} ;
    \draw (C.out) |- (B.in 2);
\end{circuitikz}
\end{document}

上述代码片段的输出

看:https://github.com/circuitikz/circuitikz/issues/166https://github.com/circuitikz/circuitikz/pull/168

相关内容