diff --git a/docs/user/README.md b/docs/user/README.md index c24f0813af..aae5f35f04 100644 --- a/docs/user/README.md +++ b/docs/user/README.md @@ -185,6 +185,7 @@ We support several modifiers that allow you to refer to scopes relative to the i Here is a diagram of the possible relative / ordinal modifiers: ![Relative ordinal diagram](images/relative_ordinal.png) +([Image source](images/relative_ordinal.tex)) And here is a table of the spoken forms: diff --git a/docs/user/images/relative_ordinal.png b/docs/user/images/relative_ordinal.png index b6021c6ed4..15d73fc92f 100644 Binary files a/docs/user/images/relative_ordinal.png and b/docs/user/images/relative_ordinal.png differ diff --git a/docs/user/images/relative_ordinal.tex b/docs/user/images/relative_ordinal.tex new file mode 100644 index 0000000000..cde48bb58a --- /dev/null +++ b/docs/user/images/relative_ordinal.tex @@ -0,0 +1,48 @@ +\documentclass[tikz]{standalone} +\usepackage{tikz} +\usetikzlibrary{decorations.pathreplacing} + +% To build: +% pdflatex relative_ordinal.tex +% convert -density 300 relative_ordinal.pdf -quality 100 -background white -alpha remove relative_ordinal.png + +\begin{document} +\def\spacing{1.4cm} +\newcommand{\abrace}[4]{ + \draw [decorate, decoration = {brace, amplitude=5pt}] (#2*\spacing, #1*0.8cm + 0.5cm) -- (#3*\spacing, #1*0.8cm + 0.5cm) + node[above=5pt, pos=0.5, scale=0.8] {\texttt{"#4"}}; +} +\newcommand{\bbrace}[4]{ + \draw [decorate, decoration ={brace, amplitude=5pt}] (#2*\spacing, #1*0.8cm + 0.5cm) -- (#3*\spacing, #1*0.8cm + 0.5cm) + node[above=-20pt, pos=0.5, scale=0.8] {#4}; +} +\newcommand{\funk}[2]{ + \draw[fill=black] (#1*\spacing,0) circle (0.1cm) node[below=3pt, text width=1cm,align=left,scale=0.7] (F#1) + {\texttt{"#2"}}; +} +\begin{tikzpicture}[ultra thick] + +\funk{0}{first funk} +\funk{1}{second funk} +\funk{2}{third previous funk} +\funk{3}{second previous funk} +\funk{4}{previous funk} +\funk{5}{funk} +\funk{6}{next funk} +\funk{7}{second next funk} +\funk{8}{third next funk} +\funk{9}{second last funk} +\funk{10}{last funk} + +\draw[latex-] (F5) -- +(0,-0.8cm) node[below=2pt,scale=0.8] {input target}; + +\abrace{0}{6}{8}{next three funks}; +\abrace{0}{2}{4}{previous three funks}; +\abrace{1}{5}{7}{three funks}; +\abrace{2}{3}{5}{three funks backward}; +\abrace{0}{0}{1}{first two funks}; +\abrace{0}{9}{10}{last two funks}; +\bbrace{-3}{10}{0}{iteration scope}; +\end{tikzpicture} + +\end{document}