texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * doc/texinfo.texi (Macro Details): Add problem w


From: Gavin D. Smith
Subject: branch master updated: * doc/texinfo.texi (Macro Details): Add problem with macro expansion inside of @math. Report from Vincent Lefèvre.
Date: Sat, 12 Nov 2022 04:55:25 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new ab71a51670 * doc/texinfo.texi (Macro Details): Add problem with macro 
expansion inside of @math.  Report from Vincent Lefèvre.
ab71a51670 is described below

commit ab71a51670c18e4d4683a19e69ed720a3447c9d3
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Nov 12 09:55:16 2022 +0000

    * doc/texinfo.texi (Macro Details): Add problem with macro
    expansion inside of @math.  Report from Vincent Lefèvre.
---
 ChangeLog        |  5 +++
 doc/texinfo.texi | 97 +++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 70 insertions(+), 32 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 62bb1ff31c..0017b2303d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-11-12  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       * doc/texinfo.texi (Macro Details): Add problem with macro
+       expansion inside of @math.  Report from Vincent Lefèvre.
+
 2022-11-11  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/texinfo.tex (\unicodechardefs): Use \arrow instead of
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index d056f8a339..b791aea816 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -13709,38 +13709,6 @@ a conditional, cannot be invoked in the middle of a 
line.  Similarly,
 macros containing line-oriented commands or text, such as
 @code{@@example} environments, may behave unpredictably in @TeX{}.
 
-@item
-If you have problems using conditionals within a macro, an alternative
-is to use separate macro definitions inside conditional blocks.  For
-example, instead of
-
-@example
-@@macro Mac
-@@iftex
-text for TeX output
-@@end iftex
-@@ifnottex
-text for not TeX output
-@@end ifnottex
-@@end macro
-@end example
-
-@noindent you can do the following instead:
-
-@example
-@@iftex
-@@macro Mac
-text for TeX output
-@@end macro
-@@end iftex
-
-@@ifnottex
-@@macro Mac
-text for not TeX output
-@@end macro
-@@end ifnottex
-@end example
-
 @item
 Texinfo commands in the expansion of a macro in the text of an index 
 entry may end up being typeset as literal text (including an ``@@'' 
@@ -13784,6 +13752,71 @@ This looks equivalent to @code{@@headings off}, but 
for @TeX{}nical
 reasons, it fails with a mysterious error message (namely,
 @samp{Paragraph ended before @@headings was complete}).
 
+@item
+Expanding macros in a math context may lead to poor spacing in
+@TeX{} output.  For example:
+
+@example
+@@iftex
+@@macro atan
+\\mathop@{\\rm atan@}
+@@end macro
+@@end iftex
+
+@@math@{@@atan@{@}(x)@}
+@end example
+
+The braces following @samp{@@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:
+
+@example
+@@tex
+\gdef\atan#1@{\mathop@{\rm atan@}@}
+@@end tex
+@end example
+
+The @samp{#1} in this definition absorbs the braces, so that the spacing
+is as expected for the @code{\mathop} object.
+
+@item
+If you have problems using conditionals within a macro, an alternative
+is to use separate macro definitions inside conditional blocks.  For
+example, instead of
+
+@example
+@group
+@@macro Mac
+@@iftex
+text for TeX output
+@@end iftex
+@@ifnottex
+text for not TeX output
+@@end ifnottex
+@@end macro
+@end group
+@end example
+
+@noindent you can do the following instead:
+
+@example
+@group
+@@iftex
+@@macro Mac
+text for TeX output
+@@end macro
+@@end iftex
+
+@@ifnottex
+@@macro Mac
+text for not TeX output
+@@end macro
+@@end ifnottex
+@end group
+@end example
+
+
+
 @item
 Macros cannot define macros in the natural way.  To do this, you must
 use conditionals and raw @TeX{}.  For example:



reply via email to

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