Formatting problem in WEAVE
Andreas Scherer
andreas_tex at freenet.de
Fri May 1 11:52:57 CEST 2020
> or there's a possible bug in WEAVE?!
A closer look at this special case shows that WEAVE gets somewhat sloppy
with math mode around "code in meta-comment":
(1) A normal array in WEB
xord: array [text_char] of ASCII_code; {comment}
gets woven into
\Y\P\4\\{xord}: \37\&{array} $[\\{text\_char}]$ \1\&{of}\5
\\{ASCII\_code};\C{comment}\2\par
\fi
All "variables" are in '\\{...}' in text mode, only the bracketed part
is in math mode. There's no need for '@+' between ';' and the comment,
and no linebreak appears in the TeX output.
(2) An array inside a meta-comment (without '@+' at the right side)
@{@!screen_pixel:array[screen_row,screen_col] of pixel_color;@}
gets woven into
\Y\P\4$\B\\{screen\_pixel}$: \37\&{array} $[\\{screen\_row},\39\\{screen%
\_col}]$ \1\&{of}\5
\\{pixel\_color};\2\6
$\T$\par
\fi
Note that 'screen_pixel' gets stuck into the $-group together with '\B'
(for '@{' in the TeX output), while '\T' is alone in a $-group, _after_
the '\6' forced break.
(3) Adding '@+' as in mf.web
@{@!screen_pixel:array[screen_row,screen_col] of pixel_color;@+@}
results in the TeX output
\Y\P\4$\B\\{screen\_pixel}$: \37\&{array} $[\\{screen\_row},\39\\{screen%
\_col}]$ \1\&{of}\5
\\{pixel\_color};\ \2\6
$\T$\par
\fi
The only difference is the '\ ' spacer before the forced line break.
(4) Ideally, WEAVE should produce significantly different output like
\Y\P\4$\B$\\{screen\_pixel}: \37\&{array} $[\\{screen\_row},\39\\{screen%
\_col}]$ \1\&{of}\5
\\{pixel\_color};\ $\T$\2\par
\fi
keeping the code object out of math mode as far as possible and
suppressing the forced break before '$\T$'.
I have no idea how to change WEAVE's grammar to achieve this effect.
Cheers,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://tug.org/pipermail/texhax/attachments/20200501/b3a01b1c/attachment.sig>
More information about the texhax
mailing list.