TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to draw a diagram as follows: enter image description here

This is my tikz code



\tikzstyle{int}=[draw, minimum size=4em]
\tikzstyle{init} = [pin edge={to-,thin,black}]

\begin{tikzpicture}[node distance=5cm,auto,>=latex', scale = 0.75, transform shape]
    \tikzstyle{line} = [draw, -latex']
    \node [int] (a) { $x^2$ };
   \node [int] (b) [right of=a] { $x^1$ };
    \node [int] (c) [right of=b] { $x^0$ };
    % \coordinate[right=1.75cm of a] (a1)  {};

    \path[->] (b) edge node { } (a);



Output is:

enter image description here

How do I make those XOR symbols in tikz?

share|improve this question
Is \node [int] (c) [shape=circle, draw, right of=b] {\Huge$+$}; what you are looking for? And replaced you existing node (c) with \node [int] (d) [right of=c] { $x^0$ }. – Peter Grill Oct 2 '12 at 5:04
You can use $\oplus$... – Paul Gaborit Oct 2 '12 at 6:23
Qrrbrbirlbel's answer is good, but look at How to center a typewriter (ttfamily) '+' in case you want to use another font. – Ignasi Oct 2 '12 at 7:01
Notice that \tikzstyle is deprecated as per Should \tikzset or \tikzstyle be used to define TikZ styles? – Claudio Fiandrino Oct 2 '12 at 7:45
up vote 3 down vote accepted



\tikzstyle{int}     = [draw, minimum size=4em]
\tikzstyle{init}    = [pin edge={to-,thin,black}]
\tikzstyle{XORgate} = [draw,circle]
\tikzstyle{line}    = [draw, -latex']

%\pgfkeyssetvalue{/tikz/node distance}{4cm}           % needs next line to work
%\pgfkeysgetvalue{/tikz/node distance}{\nodedistance} % but than I can just say \def…
\begin{tikzpicture}[node distance=\nodedistance,auto,>=latex', scale = 0.75, transform shape]
    \tikzstyle{line}=[draw, -latex']
    \node [int] (a) { $x^2$ };
    \node [int,right of=a] (b) { $x^1$ };
    \node [int,right of=b] (c) { $x^0$ };
    \node [XORgate] at ($(b)!.5!(c)$) (XOR-b-c) {\large +};
    \node [XORgate] at ($(b)!1.5!(a)$) (XOR-aa) {\large +};
    \coordinate [below of=XOR-aa,node distance=.5*\nodedistance] (below-XOR-aa);
    \node [above of=XOR-aa,node distance=1.5cm,text width=1.5cm,anchor=south,align=center] (input) {Message\\Input};
    \path[line] (c) edge (XOR-b-c)
                (XOR-b-c) edge (b)
                (b) edge (a)
                (a) edge (XOR-aa)
                (XOR-aa) -- (below-XOR-aa) -| ($(c) + (.5*\nodedistance,0pt)$) -- (c)
                (input) edge (XOR-aa)
                ($(XOR-b-c)+(0,-.5*\nodedistance)$) -- (XOR-b-c);



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.