如何在 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}

这将给你:

在此处输入图片描述

相关内容