On Mon, Nov 07, 2022 at 04:08:54PM +0100, Vincent Lefevre wrote: > Consider the following test.texi file: > > ------------------------------------------------------------ > \input texinfo @c -*-texinfo-*- > > @tex > \gdef\atan{\mathop{\rm atan}} > @end tex > > @ifnottex > @macro atan > atan > @end macro > @end ifnottex > > @node Top > @node Test > > Spacing test with atan. > > @math{@atan{}(x)} > > @math{\atan(x)} > > @bye > ------------------------------------------------------------ > > and run "texi2dvi --pdf test.texi". > > With \atan, everything is fine. But with @atan{}, I get a spurious > space between "atan" and "(x)" in the generated PDF, though the > result should be identical to \atan.
This is not actually a Texinfo problem, as you are not using a Texinfo macro, but a TeX macro. The same output difference would occur even without macros. I suspect the braces are affecting the spacing in math mode. The empty {} is treated as a symbol. You may remove the braces thusly: @tex \gdef\atan#1{\mathop{\rm atan}} @end tex See how the #1 parameter will absorb the empty braces. With this definition, @atan{} must be used, not just @atan (without braces).