I want to have a XOR node in my TikZ diagram, but couldn't find any available symbol, therefore made one myself, but I am not very happy with it.
I used the example from how to draw XOR gate symbol as a node in tikz? as basis.
\tikzstyle{XOR} = [draw,circle]
And use it as follows:
\node [XOR] {\large +};
However, there is always a padding around the +
. I want the +
to 'connect' with the circle.
Here my MWE:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,calc,positioning,automata}
\begin{document}
\tikzstyle{XOR} = [draw,circle]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[auto,>=latex', scale = 1, transform shape]
\tikzstyle{line}=[draw, -latex']
\node (XOR-aa)[XOR] {\large +};
\node [above of=XOR-aa,node distance=1.5cm,text width=1.5cm,anchor=south,align=center] (bla) {Bla};
\node [right of=XOR-aa,node distance=3cm,text width=1.5cm,anchor=east,align=center] (Blob) {Blob};
\node [left of=XOR-aa,node distance=3cm,text width=1.5cm,anchor=west,align=center] (blubb) {Blubb};
\path[line] (XOR-aa) edge (Blob)
(bla) edge (XOR-aa)
(blubb) edge (XOR-aa);
\end{tikzpicture}
\end{document}
Best Answer
The best idea I think is to define the
XOR
in such a way that automatically the+
sign is inside the circle. One possibility is:The complete example:
Notice in particular how the
line
is defined:The
shorten
allows that the arrows does not touch theXOR
: without this, a departing arrow could be confused with the the+
.The result is:
The approach allows to scale the
XOR
symbol very easily without problems; for example using:in the previous MWE leads to: