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: Gavin Smith
Subject: Re: spurious space after macro expansion in math mode for TeX output
Date: Sat, 12 Nov 2022 09:57:49 +0000

On Wed, Nov 09, 2022 at 12:47:38PM +0100, Patrice Dumas wrote:
> I am not sure that this can be easily fixed, there are lots of caveats
> put forward in the manual because macros in TeX is an area where things
> seems to be difficult to get right, but I agree that this is an issue as
> I can't see what in the macro definition would trigger an extra space
> (and the equivalent using texi2any macros would not have that space,
> though it is may not be relevant to the issue).  If it cannot be fixed,
> maybe it could be documented?

I've added the following to the manual:

   • Expanding macros in a math context may lead to poor spacing in TeX
     output.  For example:

          @iftex
          @macro atan
          \\mathop{\\rm atan}
          @end macro
          @end iftex

          @math{@atan{}(x)}

     The braces following ‘@atan’ are treated by TeX as a subformula,
     leading to extra space before the opening parenthesis.  You can
     work around this by defining a raw TeX macro instead:

          @tex
          \gdef\atan#1{\mathop{\rm atan}}
          @end tex

     The ‘#1’ in this definition absorbs the braces, so that the spacing
     is as expected for the ‘\mathop’ object.




reply via email to

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