2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00

added my TikZ examples

This commit is contained in:
Martin Thoma 2012-08-09 07:04:38 +02:00
parent dc9eb91aa2
commit fef9415b3d
92 changed files with 3624 additions and 0 deletions

View file

@ -0,0 +1,31 @@
SOURCE = singly-linked-list
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux
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-plain-svg=$(SOURCE).svg

View file

@ -0,0 +1,44 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.multipart,chains,arrows}
\tikzset{
squarecross/.style={
draw, rectangle,minimum size=18pt, fill=orange!80,
inner sep=0pt, text=black,
path picture = {
\draw[black]
(path picture bounding box.north west) --
(path picture bounding box.south east)
(path picture bounding box.south west) --
(path picture bounding box.north east);
}
}
}
\begin{document}
\begin{preview}
\begin{tikzpicture}[
list/.style={
very thick, rectangle split,
rectangle split parts=2, draw,
rectangle split horizontal, minimum size=18pt,
inner sep=4pt, text=black,
rectangle split part fill={red!20, blue!20}
},
->, start chain, very thick
]
\node[list,on chain] (A) {12};
\node[list,on chain] (B) {99};
\node[list,on chain] (C) {37};
\node[squarecross] (D) [right=of C] {};
\draw[*->] let \p1 = (A.two), \p2 = (A.center) in (\x1,\y2) -- (B);
\draw[*->] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) -- (C);
\draw[*->] let \p1 = (C.two), \p2 = (C.center) in (\x1,\y2) -- (D);
\end{tikzpicture}
\end{preview}
\end{document}