如何在 Tikz 中的邏輯閘中填滿顏色?

如何在 Tikz 中的邏輯閘中填滿顏色?

如何填滿這個AND門顏色? 在此輸入影像描述

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.gates.logic.US}
\usetikzlibrary{circuits.ee.IEC}
\begin{document}
    \begin{tikzpicture}[ circuit symbol wires]
    \node (x) at (0,1) {$x$};
    \node (y) at (0,0) {$y$};
    \node[and gate US, minimum size=32pt, draw] at (1.5,0.5) (And) {};
    \draw (x.east) -- ++(right:3mm) |- (And.input 1);
    \draw (y.east) -- ++(right:3mm) |- (And.input 2);
    \draw (And.output) -- ($(And) + (1.5,0)$);
    \node (z) at ($(And) + (1.9,0)$) {$x\& y$};
    \end{tikzpicture}
\end{document}

答案1

也許是這樣的:

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.gates.logic.US}
\usetikzlibrary{circuits.ee.IEC}
\begin{document}
    \begin{tikzpicture}[ circuit symbol wires]
    \node (x) at (0,1) {$x$};
    \node (y) at (0,0) {$y$};
    \node[and gate US, minimum size=32pt, draw, fill =red] at (1.5,0.5) (And) {};
    \draw (x.east) -- ++(right:3mm) |- (And.input 1);
    \draw (y.east) -- ++(right:3mm) |- (And.input 2);
    \draw (And.output) -- ($(And) + (1.5,0)$);
    \node (z) at ($(And) + (1.9,0)$) {$x\& y$};
    \end{tikzpicture}
\end{document}

這會給你:

在此輸入影像描述

相關內容