Skip to content

Commit b722fe4

Browse files
author
Martin Rykfors
committed
Line up the funks vertically in the diagram
1 parent 4790426 commit b722fe4

File tree

3 files changed

+35
-25
lines changed

3 files changed

+35
-25
lines changed

docs/user/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ For example, `"take funk blue air"` selects the function containing the token wi
182182

183183
We support several modifiers that allow you to refer to scopes relative to the input target, or relative to the canonical iteration scope of the scope type. For example, the iteration scope of functions is a class, of tokens is a line, of characters is a token, etc.
184184

185-
Here is a diagram of the possible relative / ordinal modifiers:
185+
Here is a diagram of the possible relative / ordinal modifiers using the `funk` scope as an example:
186186

187-
![Relative ordinal diagram](images/relative_ordinal.png)
188-
([Image source](images/relative_ordinal.tex))
187+
<img src="images/relative_ordinal.png" alt="Relative ordinal diagram" width="50%" height="50%">
188+
189+
([Image source](https://github.com/raw/cursorless-dev/cursorless/main/docs/user/images/relative_ordinal.tex))
189190

190191
And here is a table of the spoken forms:
191192

docs/user/images/relative_ordinal.png

38.5 KB
Loading

docs/user/images/relative_ordinal.tex

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,57 @@
11
\documentclass[tikz]{standalone}
22
\usepackage{tikz}
3-
\usetikzlibrary{decorations.pathreplacing}
3+
\usetikzlibrary{decorations.pathreplacing,calligraphy}
44

55
% To build:
66
% pdflatex relative_ordinal.tex
7+
% To auto build on save:
8+
% latexmk -pdf -pvc -halt-on-error relative_ordinal.tex
9+
% To build png:
710
% convert -density 300 relative_ordinal.pdf -quality 100 -background white -alpha remove relative_ordinal.png
811

912
\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};
1822
}
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"}};
2227
}
23-
\begin{tikzpicture}[ultra thick]
28+
29+
\begin{tikzpicture}
2430

2531
\funk{0}{first funk}
2632
\funk{1}{second funk}
2733
\funk{2}{third previous funk}
2834
\funk{3}{second previous funk}
2935
\funk{4}{previous funk}
30-
\funk{5}{funk}
36+
\funk[red]{5}{funk}
3137
\funk{6}{next funk}
3238
\funk{7}{second next funk}
3339
\funk{8}{third next funk}
3440
\funk{9}{second last funk}
3541
\funk{10}{last funk}
3642

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};
3854

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};
4655
\end{tikzpicture}
4756

4857
\end{document}

0 commit comments

Comments
 (0)