On 2022-10-16 12:18:51 +0100, Gavin Smith wrote:
> On Sat, Oct 15, 2022 at 12:40:32PM +0200, Vincent Lefevre wrote:
> > The spaces in math mode can normally stretch and shrink (not in
> > the same way as outside of math mode, though). But there are some
> > TeX commands that changes spaces to fixed spaces in math mode.
> > I just wanted to be sure that @w did not change anything in this
> > respect.
>
> The answer is I do not know, although I don't expect there would be
> a problem.
@w doesn't work correctly in math mode:
------------------------------------------------------------
\input texinfo @c -*-texinfo-*-
@documentencoding UTF-8
@node Top
@node Test
Formatting test.
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @math{a + b}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
zzzzzzzzzzzzzzzzzz @w{@math{a + b}}
@bye
------------------------------------------------------------
One can see that with @w, spaces do not stretch.
However, a solution is to define a macro with @iftex and @ifnottex
so that @w is not used for TeX. Basically, @math{T} for TeX, @w{T}
otherwise. (I recall that the goal is to use that when T is a very
simple math expression, so that it is OK for Info and HTML without
any special handling.)
For instance:
------------------------------------------------------------
\input texinfo @c -*-texinfo-*-
@documentencoding UTF-8
@iftex
@macro m {T}
@math{\T\}
@end macro
@end iftex
@ifnottex
@macro m {T}
@w{\T\}
@end macro
@end ifnottex
@node Top
@node Test
Formatting test.
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
zzzzzzzzzzzzzzzzzz @m{a + b}
@bye
------------------------------------------------------------
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)