bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: spurious space after macro expansion in math mode for TeX output


From: Vincent Lefevre
Subject: Re: spurious space after macro expansion in math mode for TeX output
Date: Wed, 9 Nov 2022 16:44:07 +0100
User-agent: Mutt/2.2.8+49 (040ba998) vl-149028 (2022-11-07)

I've done various tests with GNU Texinfo 6.8 (texinfo 2021-04-25.21)
and GNU Texinfo 7.0 (texinfo 2022-11-07.17). They give the same
results; see comments in the testcase below.

------------------------------------------------------------------
\input texinfo    @c -*-texinfo-*-

@tex
\gdef\texMM{\mathop{\tt MM}}
@end tex

@iftex
@macro MM
\\mathop{\\tt MM}
@end macro
@macro MMa {T}
\\mathop{\\tt MM}
@end macro
@macro MMb {T}
{\\mathop{\\tt MM}}
@end macro
@end iftex

Spacing test with mathop.

@math{\mathop{\tt MM}(x)}

@math{\texMM(x)}

@math{@MM{}(x)}         @c Space before and after "MM"

@math{@MMa{}(x)}        @c Space before "MM"

@math{@MMb{}(x)}        @c Correct

@math{k\mathop{\tt MM}(x)}

@math{k\texMM(x)}

@math{k@MMa{}(x)}       @c Correct

@math{k@MMb{}(x)}       @c Missing space before "MM"

@math{1 + \mathop{\tt MM}(x)}

@math{1 + \texMM(x)}

@math{1 + @MMa{}(x)}    @c Space before "MM"

@math{1 + @MMb{}(x)}    @c Correct

@bye
------------------------------------------------------------------

It seems that Texinfo adds something like {} at the beginning of
the Texinfo macro expansion, because in the test of the TeX macro,
if I change

  \gdef\texMM{\mathop{\tt MM}}

to

  \gdef\texMM{{}\mathop{\tt MM}}

then I get exactly the same behavior as with the Texinfo macro

@macro MMa {T}
\\mathop{\\tt MM}
@end macro

While there is a workaround for the space after the operator name
(i.e. adding a dummy argument in the macro definition), there does
not seem any for the space before the operator name (as soon as
Texinfo has added something like {}, information on what is present
before is lost), except case-by-case hacks (which is precisely what
should be avoided). But ideally, both issues should be fixed.

-- 
Vincent Lefèvre <vincent@vinc17.net> - 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]