File: Counting.m4

package info (click to toggle)
texlive-base 2022.20230122-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 943,248 kB
  • sloc: perl: 43,776; sh: 5,749; makefile: 3,870; javascript: 3,034; ruby: 2,266; tcl: 2,130; xml: 1,874; python: 1,025; awk: 606; cpp: 549; lisp: 447; ansic: 103; sed: 8
file content (26 lines) | stat: -rw-r--r-- 551 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
.PS
# Counting.m4
gen_init

  g = 0.4                          # grid size
  define grid { (($2)*g,-($1)*g) }
  circlerad = 0.1

for i=1 to 4 do {
  sprintf(`"$S_%g$:"',i) ljust at grid(i,-0.5)
  for j=1 to 4 do { if i+j < 8 then {
    sprintf(`"$s_{%g%g}$"',i,j) at grid(i,j) } } }

"$\vdots$" at grid(4.75,0)
for i=1 to 3 do { `"$\cdots$"' at grid(i,5) }
"$\cdots$" at grid(4,4)

P: grid(1,1)
for k=3 to 5 do {
  for i=1 to k-1 do { if (k%2==1) then { m=i; n=k-i } else { m=k-i; n=i }
    Q: grid(m,n)
    arrow from P to Q chop
    P: Q }
  }

.PE