2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 14:28:05 +02:00
LaTeX-examples/tikz/singly-linked-list/singly-linked-list.tex
2019-01-13 02:23:14 +08:00

44 lines
1.2 KiB
TeX

\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{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[*->] (A.two |- A.center) -- (B);
\draw[*->] (B.two |- B.center) -- (C);
\draw[*->] (C.two |- C.center) -- (D);
\end{tikzpicture}
\end{preview}
\end{document}