bug-texinfo
[Top][All Lists]
Advanced

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

Whitespace and Macros and Bugs


From: Michael Witten
Subject: Whitespace and Macros and Bugs
Date: Wed, 20 Oct 2010 13:18:21 -0700 (PDT)

The following Texinfo examples were processed into
the shown Info output using:

  makeinfo /path/to/file/containing/example

where makeinfo has the following version:

  makeinfo (GNU texinfo) 4.13

Also, the examples (including blank lines) are indented
by 2 spaces relative to the surrounding non-example text
and offset from the surrounding non-example text by one
blank line.

###################
#### Example 0 ####
###################

  @setfilename test.info
  A
  @example
  B
  @end example
  C
  @bye

produces:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
       B
     C
  

Is there a particular reason why the address@hidden' line yields a
blank line? Why not just output nothing at all, thereby
producing this:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
       B
     C

which no longer has the last blank line (though, note that
the last line still ends with a newline).

###################
#### Example 1 ####
###################

  @setfilename test.info
  @macro Example
  @example
  @end macro
  @macro endExample
  @end example
  @end macro
  A
  @Example
  B
  @endExample
  C
  @bye


produces:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
  
       B
  
     C
  

Now, compare that output to the output of Example 0:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
       B
     C
  

The macros have introduced whitespace, namely a blank line
between `A' and `B' and a blank line between `B' and `C'.

Is this not a bug? Is it not at least inconsistent behavior?

According to:

  info texinfo 'Defining Macros'

we have:

  You use the Texinfo address@hidden' command to define a macro, like this:
  
       @macro MACRONAME{PARAM1, PARAM2, ...}
       TEXT ... \PARAM1\ ...
       @end macro
  
  ...
  
    The newlines after the address@hidden' line and before the address@hidden 
macro' line
  are ignored, that is, not included in the macro body.  All other
  whitespace is treated according to the usual Texinfo rules.

This suggests that it is a bug.

###################
#### Example 2 ####
###################

  @setfilename test.info
  @macro Example
  @example
  
  
  
  
  @end macro
  @macro endExample
  @end example
  @end macro
  A
  @Example
  B
  @endExample
  C
  @bye

produces:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.

  A
  
  
  
  
       B
  
     C
  
As you can see, the blank lines were copied from the input to the output;
however, this contradicts the Texinfo manual as quoted earlier:
  
    The newlines after the address@hidden' line and before the address@hidden 
macro' line
  are ignored, that is, not included in the macro body.  All other
  whitespace is treated according to the usual Texinfo rules.

Perhaps the manual should read:
  
    The newlines after the address@hidden' line are ingnored (that is, they are
    not included in the macro body). Similarly, newlines before the
    address@hidden macro' line are ignored unless they are within an unended
    environment within the macro body.  All other whitespace is treated
    according to the usual Texinfo rules.

But wait!

###################
#### Example 3 ####
###################

  @setfilename test.info
  @macro b
  @example
  B
  @end example
  @end macro
  A
  @b
  C
  @bye


produces:

This is test.info, produced by makeinfo version 4.13 from test.texinfo.

  A
       B
  
     C
  

Again, compare that to the output of Example 0:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
       B
     C
  
The macro has introduced whitespace, namely a blank line
between `B' and `C'; I don't have a rationalization
for this one.

###################
#### Example 4 ####
###################

  @setfilename test.info
  @macro b
  B
  @end macro
  A
  @example
  @b
  @end example
  C
  @bye

produces:

  This is test.info, produced by makeinfo version 4.13 from test.texinfo.
  
  A
       B
     C
  

which is as expected; the Examples 3 and 4  suggest that
there is a bug triggered when address@hidden' (and possibly
other) environments are used within macro bodies.

Sincerely,
Michael Witten



reply via email to

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