[tex-k] another bug in Appendix D of The METAFONTbook

胡亚捷 (Hu Yajie) 2500418497 at qq.com
Thu Oct 8 04:35:25 CEST 2020


On page 289, line 20 of The METAFONTbook, change
    if {{pair x cand x>(0,0)}}: A else: B fi.
to
    if {{(pair x) cand x>(0,0)}}: A else: B fi.
otherwise the "pair" would be treated as a type declaration, since
it occurs at the beginning of a group.

Here's the related code to reproduce the bug:

let {{ = begingroup; let }} = endgroup;
def cand text q = startif true q else: false fi enddef;
tertiarydef p startif true = if p: enddef;
show if {{pair x cand x>(0,0)}}: A else: B fi; % produces errors

def corrected = if {{(pair x) cand x>(0,0)}}: A else: B fi enddef;
numeric x; show corrected; % prints B
pair x; x=(-1,-1); show corrected; % prints B
x:=(1,1); show corrected; % prints A

(Shocked to find that nobody tried the examples in Appendix D before 2014.)



More information about the tex-k mailing list.