# Veitch diagram draw with TikZ [duplicate]

How can I make the same diagram like this in LaTeX?

I see that i could use package karnaugh but i don´t like placement of x.

## marked as duplicate by Red, Benedikt Bauer, Andrew Swann, henrique, Claudio FiandrinoOct 25 '13 at 12:32

• Is there any chance to create the same diagram in latex without package karnaugh. – Luka Toni Oct 20 '13 at 13:53

Use package karnaugh.

\documentclass{article}
\input{kvmacros}

\begin{document}
\karnaughmap{4}{$F(x_1,x_2,x_3,x_4)=$}{{$x_1$}{$x_2$}{$x_3$}{$x_4$}}{1111100100011011}{}
\end{document}


You can also draw this stuff with TikZ:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) grid (4,4);
\node at (.5,.5){1};
\node at (3.5,.5){1};
\node at (1.5,1.5){1};
\node at (1.5,3.5){1};
\node at (3.5,3.5){1};
\draw (0,4.3) --node[midway, above]{$x_1$} (2,4.3);
\draw (-0.3,4) --node[midway, left]{$x_2$} (-0.3,2);
\draw (1,-0.3) --node[midway, below]{$x_3$} (3,-0.3);
\draw (4.3,1) --node[midway, right]{$x_4$} (4.3,3);
\end{tikzpicture}
\end{document}


You could also use a picture environment like the karnaugh package does internally, or PSTricks, or any other lesser-known LaTeX graphics environment since the drawing required by a Karnaugh map is very simple.

• is it possible to change a possition of x ? – Luka Toni Oct 20 '13 at 10:32
• @LukaToni I don't think so. – marczellm Oct 20 '13 at 11:32