# Three (or more leg) xor gate for tikz

You know how the tikz gate libraries have 3-input OR and AND gates but not an XOR one. I am specifically looking for the US style of it. I was somewhat surprised that this isn't available. I was thinking about producing it myself but looking through the code for the OR is somewhat daunting. Is there an easy way to do it, maybe somehow inheriting from the OR?

The image I am looking for looks like this , not like the IEEE one, except for the three or more legs of course.

• Check out elfsoft2000.com/projects/index.htm While this is for Circuitikz, creating a new node is the same as for Tikz. If it still seems like too much work, I could make one. Jan 23 '14 at 4:29
• Could you provide a picture of the US style-based XOR? Jan 23 '14 at 10:39

If you want easy:

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{circuits.logic.US,calc}

\begin{document}

\begin{tikzpicture}[circuit logic US]
\draw (0,0) node[xor gate](XOR1){}
($(XOR1.north west)!.5!(XOR1.input 1)$) -- ++(-.5,0)
(XOR1.input 1) -- ++(-.5,0)
(XOR1.west) -- ++(-.5,0)
(XOR1.input 2) -- ++(-.5,0)
($(XOR1.south west)!.5!(XOR1.input 2)$) -- ++(-.5,0)
(XOR1.output) -- ++(.5,0);
\end{tikzpicture}

\end{document} • Mar 5 '18 at 15:21

There is even more simple way!

\documentclass[border=10pt]{standalone}
\usepackage[american,siunitx]{circuitikz}
\usepackage{amsmath}
\usepackage{tikz}
%\usepackage{everyshi-2001-05-15}
%\usetikzlibrary{circuits.logic.US,circuits.logic.IEC}
\begin{document}
\begin{circuitikz}%[circuit logic US]
\draw (0,0) node[xor port ,scale=2, number inputs=3](XOR1){}
;
\end{circuitikz}
\end{document}

• Welcome to TeX.SE! Jan 27 at 8:50