help-texinfo
[Top][All Lists]
Advanced

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

Re: Error with macro use case where arguments span in several lines


From: Gavin Smith
Subject: Re: Error with macro use case where arguments span in several lines
Date: Thu, 19 Nov 2020 17:53:53 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

On Wed, Nov 18, 2020 at 09:46:00AM +0100, Hilaire Fernandes wrote:
> Hi,
> 
> With a figure macro defined as:
> 
> @c Figure with caption @macro figure{caption,file,width} @ifnotplaintext
>  @float Figure,\file\  @center @image{\file\,\width\cm}  @caption{\caption\}
>  @end float @end ifnotplaintext @ifplaintext  @float Figure
>  @caption{\caption\}  @end float @end ifplaintext @iftex    @sp 1 @end iftex
> @end macro
> 
> It is fined when used as:
> 
> @figure{The File List tool@comma{} to install a change set and
> more,ch10-FileListChangeSet,11}
> 
> But got error when used and formated in two lines:
> 
> @figure{The File List tool@comma{} to install a change set and more,
> ch10-FileListChangeSet,11}
> 
> It is strange because with some other macro I don't have issue to put the
> arguments in several lines to improve readability of the source text
> document.
> 
> Thanks
> 
> Hilaire

The problem seems to be with the \xeatspaces macro.  This is barfing at
being given an argument beginning with a newline (as the comma is right
before the newline, that is included in the argument).  With
@tracingmacros=1:

@floatlabel ->@xeatspaces {
ch10-FileListChangeSet}

@xeatspaces ->@eatspaces

@eatspaces #1->@expandafter @trim@ @expandafter {#1 }
#1<-
ch10-FileListChangeSet


->@par

@trim@ #1->@trim@@ @#1 @ #1 @ @@

Runaway argument?
{
! Paragraph ended before @trim@ was complete.

I tried to give active newline a definition that would make it disappear
in this context, but this didn't work, as you can't make new definitions
in TeX when you are in an expansion-only context.

It's related to a recently reported problem:
https://lists.gnu.org/archive/html/help-texinfo/2020-10/msg00001.html

It would ideal if \xeatspaces could be run earlier.  I'll think about
this again but may not succeed.

What could perhaps be done is, when the macro has several parameters, to
make ends of lines insignificant.  This doesn't conflict with any of the
test cases in texinfo-tex-test.texi; however, you could imagine a use
case for a @macro where this was important, where the arguments are like
@inlinefmt where newlines should be kept in just one of the arguments.



reply via email to

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