bug-texinfo
[Top][All Lists]
Advanced

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

texi2any should warn if \, used in macro argument


From: Gavin Smith
Subject: texi2any should warn if \, used in macro argument
Date: Sun, 19 Feb 2023 14:05:47 +0000

The manual states in '(texinfo)Invoking Macros':

    Passing macro arguments containing commas requires care, since commas
  also separate the arguments.  To include a comma character in an
  argument, the most reliable method is to use the ‘@comma{}’ command.
  For ‘texi2any’, you can also prepend a backslash character, as in ‘\,’,
  but this does not work with TeX.

I found in the groff manual there was incorrect output for input
like the following (modified slightly to work as a minimal example):

  @macro Defesc{name, delimI, arg, delimII}
  @deffn Escape @t{\name\\delimI\}@var{\arg\}@t{\delimII\}
  @c
  @end macro
  
  @macro endDefesc
  @end deffn 
  @end macro
  
  @Defesc {\\\,, , , }
  @cindex left italic correction (@code{\,})
  Modify the spacing of the following glyph so that the spacing between
  that glyph and the preceding glyph is correct if the preceding glyph is
  @endDefesc

The first argument to @Defesc is supposed to be interpreted as '\,' but
instead it is taken as '\\' and there is a spurious comma afterwards.

(I check on the groff webpages and the PDF manual they offer for download
does actually have the correct output, which is likely because they
macro-expand with texi2any before TeX processing.)

Nonetheless, texi2any does not warn about this construct which is incorrect
for TeX.  We could fix this in two ways:
* Make \, work in TeX
* Issue a warning from texi2any to say that @comma{} should be used instead

Another way of allowing commas in macro arguments is to use @asis:

  @Defesc {@asis{\,}, , , }

which may be nicer than

  @Defesc {\@comma{}, , , }

We could recommend @asis in the manual and/or a new warning message.




reply via email to

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