[tex-k] Inconsistent rendering of z[k] when k is a capsule in The METAFONTbook

胡亚捷 (Hu Yajie) 2500418497 at qq.com
Mon Jul 20 05:11:48 CEST 2020


(This is an expanded version on my previous bug report on page C234, line -7.)

Inside a loop like `for k=1 upto 4', the variable z[k] is sometimes rendered
as $z_k$:

Page C113, line -9 (mfbook.tex line 6501)
    ^@for@ $k=1$ @upto@ 4: $z_{k+4}=z_k+({2\over3}s,{1\over3}s)$; \ @endfor...
Page C113, line -5 (mfbook.tex line 6508)
    @for@ $k=1$ @upto@ 4: @draw@ $z_k\dashto z_{k+4}$; \ @endfor at .\cr
Page C114, line 7 (mfbook.tex line 6572)
    @for@ $k=0$ @upto@ 4: \ $z_k="center"+("radius",0)$
Page C234, line -7 (mfbook.tex line 1675)
    @for@ $k=1$ @upto@ 6: $z_k'=.2[z_k,z_0]$; @endfor@\cr
Page C242, line 14 (mfbook.tex line 6530)
    @for@ $k=1$ @upto@ 4: \ @draw@ $z_k\dashto z_{k+4}$; \ @endfor at .\cr

And sometimes rendered as $z[k]$ (where k is the looped variable):

Page C126, lines 7--8 (mfbook.tex lines 7378--9)
    @for@ $n=0$ @upto@ 12:\cr
    \quad ^@unfill@ $"branch"[n]$ shifted $(150,50)$ scaled $(w/300)$;\cr
Page C127, line -13 (mfbook.tex line 7456)
    @for@ $n=3$ @upto@ 9: $z[n]=z[n-3]+(200,0)$; \ @endfor@\cr
Page C138, lines 22-23 (mfbook.tex lines 8220--2)
    21&@for@ $n=1,3,4,5,6,7,9$:
    \ @forsuffixes@ $e=l,,r$: \ @forsuffixes@ $\$=b,c$:\cr
    22&\quad $z_{\$[n]e}=z_{a[n]e}$ transformed \$; \ @endfor@ @endfor@ @en...
Page C173, line 11 (mfbook.tex lines 10099--10100)
    \quad $"z\_"\,[1]$ @for@ $k=2$ @upto@ $"n\_"-1$:
     $\ldots"z\_"\,[k]\{"dz\_"\}$ @endfor@\hidewidth\cr

The latter rendering seems better because: Since $x_2$ is typed x2, a reader
might assume $z_k$ is typed z k and it will become z 1, ..., z 4 during the
loop, but this is not the case:

*for k=1 upto 4: z[k+4]=z k+(2/3s, 1/3s); endfor
! Extra tokens will be flushed.
<to be read again>
                   (1)
<for(1)> z[(EXPR0)+4]=z(EXPR0)
                              +(2/3s,1/3s); ENDFOR
<*> ...k=1 upto 4: z[k+4]=z k+(2/3s, 1/3s); endfor

?

In other words, capsules cannot be used directly as a <subscript> without
being enclosed in brackets.

----

Previous reports:
https://github.com/dine2014/texbook-mfbook-bugs/blob/master/bugs.md



More information about the tex-k mailing list.