|
1 | 1 | \documentclass[tikz]{standalone}
|
2 | 2 | \usepackage{tikz}
|
3 |
| -\usetikzlibrary{decorations.pathreplacing} |
| 3 | +\usetikzlibrary{decorations.pathreplacing,calligraphy} |
4 | 4 |
|
5 | 5 | % To build:
|
6 | 6 | % pdflatex relative_ordinal.tex
|
| 7 | +% To auto build on save: |
| 8 | +% latexmk -pdf -pvc -halt-on-error relative_ordinal.tex |
| 9 | +% To build png: |
7 | 10 | % convert -density 300 relative_ordinal.pdf -quality 100 -background white -alpha remove relative_ordinal.png
|
8 | 11 |
|
9 | 12 | \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}; |
| 13 | + |
| 14 | +\def\vspacing{0.5cm} |
| 15 | +\def\hspacing{0.4cm} |
| 16 | +\def\overshoot{0.1cm} |
| 17 | + |
| 18 | +\newcommand{\abrace}[5][0.5]{ |
| 19 | + \draw [decorate, decoration = {calligraphic brace, amplitude=5pt, aspect=#1}, very thick] |
| 20 | + (#2*\hspacing + 0.3cm, -#3*\vspacing+\overshoot) -- (#2*\hspacing + 0.3cm, -#4*\vspacing-\overshoot) |
| 21 | + node[right=5pt, pos=#1, scale=0.8] {#5}; |
18 | 22 | }
|
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"}}; |
| 23 | + |
| 24 | +\newcommand{\funk}[3][black]{ |
| 25 | + \draw[fill=#1] (0,-#2*\vspacing) circle (0.1cm) node[left=3pt,align=right,scale=0.8] |
| 26 | + {\texttt{"#3"}}; |
22 | 27 | }
|
23 |
| -\begin{tikzpicture}[ultra thick] |
| 28 | + |
| 29 | +\begin{tikzpicture} |
24 | 30 |
|
25 | 31 | \funk{0}{first funk}
|
26 | 32 | \funk{1}{second funk}
|
27 | 33 | \funk{2}{third previous funk}
|
28 | 34 | \funk{3}{second previous funk}
|
29 | 35 | \funk{4}{previous funk}
|
30 |
| -\funk{5}{funk} |
| 36 | +\funk[red]{5}{funk} |
31 | 37 | \funk{6}{next funk}
|
32 | 38 | \funk{7}{second next funk}
|
33 | 39 | \funk{8}{third next funk}
|
34 | 40 | \funk{9}{second last funk}
|
35 | 41 | \funk{10}{last funk}
|
36 | 42 |
|
37 |
| -\draw[latex-] (F5) -- +(0,-0.8cm) node[below=2pt,scale=0.8] {input target}; |
| 43 | +\draw[fill=red] (-3.3cm,-11.5*\vspacing) circle (0.1cm) node[right=3pt,align=left,scale=0.8] {= input target}; |
| 44 | + |
| 45 | +% \abrace [aspect], horizontal offset, start funk, end funk, text |
| 46 | +\abrace[0.7]{0}{6}{8}{\texttt{"next three funks"}}; |
| 47 | +\abrace[0.3]{0}{2}{4}{\texttt{"previous three funks"}}; |
| 48 | +\abrace{1}{5}{7}{\texttt{"three funks"}}; |
| 49 | +\abrace{2}{3}{5}{\texttt{"three funks backward"}}; |
| 50 | +\abrace{0}{0}{1}{\texttt{"first two funks"}}; |
| 51 | +\abrace{0}{9}{10}{\texttt{"last two funks"}}; |
| 52 | + |
| 53 | +\abrace{11.5}{0}{10}{iteration scope}; |
38 | 54 |
|
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 | 55 | \end{tikzpicture}
|
47 | 56 |
|
48 | 57 | \end{document}
|
0 commit comments