2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

Add XOR problem graphic

This commit is contained in:
Martin Thoma 2016-07-21 20:39:24 +02:00
parent 0085bb50d5
commit 2ec24b14b8
4 changed files with 71 additions and 0 deletions

33
tikz/xor-problem/Makefile Normal file
View file

@ -0,0 +1,33 @@
SOURCE = xor-problem
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
rm $(SOURCE)1.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](topology-simplex-1.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,35 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{tkz-fct}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{tikzpicture}
\tikzstyle{point}=[thick,draw=black,cross out,inner sep=0pt,minimum width=4pt,minimum height=4pt]
\begin{axis}[
legend pos=south west,
axis x line=middle,
axis y line=middle,
grid = major,
width=6cm,
height=6cm,
grid style={dashed, gray!30},
xmin=0, % start the diagram at this x-coordinate
xmax=1, % end the diagram at this x-coordinate
ymin=0, % start the diagram at this y-coordinate
ymax=1, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
tick align=outside,
minor tick num=-3,
enlargelimits=true]
% \addplot[domain=0:2.5, red, thick,samples=20] {-x+2.5};
\node[point,label={[label distance=0cm,text=red]135:$0$},red] at (axis cs:1,0) {};
\node[point,label={[label distance=0cm,text=red]-45:$0$},red] at (axis cs:0,1) {};
\node[point,label={[label distance=0cm,text=blue]45:$1$},blue] at (axis cs:0,0) {};
\node[point,label={[label distance=0cm,text=blue]-135:$1$},blue] at (axis cs:1,1) {};
\end{axis}
\end{tikzpicture}
\end{document}