On Tue, Oct 06, 2026 at 08:12:46PM +0100, Gavin Smith wrote:
> On Sun, Oct 04, 2026 at 03:24:54PM +0200, Patrice Dumas wrote:
> > If we want to go in that direction, we would need to change the
> > specification of the Texinfo language, as explained in the "Multiple
> > Spaces" Texinfo manual node, which is (from the Info reader):
> > 
> >    Occasionally, you may want to produce several consecutive spaces,
> >  either for purposes of example (e.g., what your program does with
> >  multiple spaces as input), or merely for purposes of appearance in
> >  headings or lists.  Texinfo supports three commands: ‘@SPACE’, ‘@TAB’,
> >  and ‘@NL’, all of which insert a single space into the output.  (Here,
> >  ‘@SPACE’ represents an ‘@’ character followed by a space, i.e., ‘@ ’,
> >  ‘TAB’ represents an actual tab character, and ‘@NL’ represents an ‘@’
> >  character and end-of-line, i.e., when ‘@’ is the last character on a
> >  line.)
> > 
> > I think that this matches well the texi2any behaviour, but not the TeX
> > behaviour, therefore we need to change this specification before
> > changing texi2any.
> 
> I am working on adding a note about this to the manual, but I need to
> investigate this further as it seems that simply "A@  B" does not
> produce the same output with texi2any as with texinfo.tex.  texi2any
> for Info output produces "A  B" which is expected, with two spaces, but
> texinfo.tex appears to only produce a single space.

Mystery solved - TeX skips spaces after a "control space".  Here's how
"TeX by Topic" explains it:

    State S is entered in any mode after a control word or control space
    (but after no other control symbol), or, when in state M, after a
    space. In this state all subsequent spaces or end-of-line characters
    in this input line are discarded.

I've added text to the manual following your suggestion:

       For consistent output regardless of whether ‘texi2any’ or TeX is
    processing your Texinfo file, you should always follow a ‘@SPACE’ or
    ‘@TAB’ command with a non-whitespace character on the same line.  The
    reason for this is that TeX ignores space characters following ‘@SPACE’,
    and also strips trailing whitespace from input lines, so treats ‘@SPACE’
    at the end of a line as if the ‘@NL’ command had appeared instead.
    
       One workaround to use ‘@SPACE’ at the end of a line is to add an
    empty ‘@w{}’ after the command.  For example:
    
         A@ @w{}
         B.
    
       This produces:
    
         A  B.
    
    --with two spaces between ‘A’ and ‘B’, one resulting from the ‘@ ’, and
    the second resulting from the end-of-line.


Reply via email to