2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
LaTeX-examples/tikz/karnaugh-map/karnaugh-map.tex
Martin Thoma 7740f0147f Remove trailing spaces
The commands

find . -type f -name '*.md' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

and

find . -type f -name '*.tex' -exec sed --in-place 's/[[:space:]]\+$//' {} \+

were used to do so.
2015-10-14 14:25:34 +02:00

55 lines
1.4 KiB
TeX

\documentclass[border=2pt]{standalone}
\usepackage[dvipsnames]{xcolor}
\input{kvmacros}
\usepackage{tikz}
\usetikzlibrary{calc}%
\newcommand{\tikzmark}[1]{%
\tikz[overlay, remember picture, baseline] \node (#1) {};%
}
\newcommand{\DrawArrow}[3][]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[
->, thick,% distance=\ArcDistance,
%shorten <=\ShortenBegin, shorten >=\ShortenEnd,
%out=\OutAngle, in=\InAngle, Arrow Style, #2
#1
]
($(#2)+(-0.50em,3.5ex)$) to
($(#3)+(1.5em,0.0ex)$);
\end{tikzpicture}% <-- important
}
\begin{document}
\karnaughmap{4}{$f(w,x,y,z)$}{{$w$}{$x$}{$y$}{$z$}}%
{
1100
1100
0011
0101
}
{
\textcolor{Blue}{
\put(2,3.5){\oval(3.9,0.9)[]}
}
\textcolor{WildStrawberry}{
\put(0.9,3.5){\oval(1.7,0.8)[]}
}
\textcolor{Green}{
\put(0.7,1.5){\tikzmark{11}\oval(1.9,0.9)}
}
\textcolor{Sepia}{
\put(1.5,1.5){\oval(1.6,0.7)}
}
\textcolor{Red}{
\put(1.92,1){\oval(0.9,1.9)}
}
\textcolor{LimeGreen}{
\put(1.76,-0.2){\tikzmark{13}\oval(0.9,2.1)[t]}
\put(1.76,4.2){\oval(0.9,2.1)[b]}
}
}
\DrawArrow[red, ultra thick, out=-180, in=-90, distance=1.5em, shorten >= -4.5ex]{13}{11}
\end{document}