|
| 1 | +\documentclass[tikz]{standalone} |
| 2 | +\usepackage{tikz} |
| 3 | +\usetikzlibrary{decorations.pathreplacing} |
| 4 | + |
| 5 | +% To build: |
| 6 | +% pdflatex relative_ordinal.tex |
| 7 | +% convert -density 300 relative_ordinal.pdf -quality 100 -background white -alpha remove relative_ordinal.png |
| 8 | + |
| 9 | +\begin{document} |
| 10 | +\def\spacing{1.4cm} |
| 11 | +\newcommand{\abrace}[4]{ |
| 12 | + \draw [decorate, decoration = {brace, amplitude=5pt}] (#2*\spacing, #1*0.8cm + 0.5cm) -- (#3*\spacing, #1*0.8cm + 0.5cm) |
| 13 | + node[above=5pt, pos=0.5, scale=0.8] {\texttt{"#4"}}; |
| 14 | +} |
| 15 | +\newcommand{\bbrace}[4]{ |
| 16 | + \draw [decorate, decoration ={brace, amplitude=5pt}] (#2*\spacing, #1*0.8cm + 0.5cm) -- (#3*\spacing, #1*0.8cm + 0.5cm) |
| 17 | + node[above=-20pt, pos=0.5, scale=0.8] {#4}; |
| 18 | +} |
| 19 | +\newcommand{\funk}[2]{ |
| 20 | + \draw[fill=black] (#1*\spacing,0) circle (0.1cm) node[below=3pt, text width=1cm,align=left,scale=0.7] (F#1) |
| 21 | + {\texttt{"#2"}}; |
| 22 | +} |
| 23 | +\begin{tikzpicture}[ultra thick] |
| 24 | + |
| 25 | +\funk{0}{first funk} |
| 26 | +\funk{1}{second funk} |
| 27 | +\funk{2}{third previous funk} |
| 28 | +\funk{3}{second previous funk} |
| 29 | +\funk{4}{previous funk} |
| 30 | +\funk{5}{funk} |
| 31 | +\funk{6}{next funk} |
| 32 | +\funk{7}{second next funk} |
| 33 | +\funk{8}{third next funk} |
| 34 | +\funk{9}{second last funk} |
| 35 | +\funk{10}{last funk} |
| 36 | + |
| 37 | +\draw[latex-] (F5) -- +(0,-0.8cm) node[below=2pt,scale=0.8] {input target}; |
| 38 | + |
| 39 | +\abrace{0}{6}{8}{next three funks}; |
| 40 | +\abrace{0}{2}{4}{previous three funks}; |
| 41 | +\abrace{1}{5}{7}{three funks}; |
| 42 | +\abrace{2}{3}{5}{three funks backward}; |
| 43 | +\abrace{0}{0}{1}{first two funks}; |
| 44 | +\abrace{0}{9}{10}{last two funks}; |
| 45 | +\bbrace{-3}{10}{0}{iteration scope}; |
| 46 | +\end{tikzpicture} |
| 47 | + |
| 48 | +\end{document} |
0 commit comments