Re: @anchor on @item line

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.general,gmane.emacs.devel
Message-ID <ZVEmPAUAomcDvuEq@beigestar>
On Tue, Nov 07, 2023 at 11:29:24AM +0100, Patrice Dumas wrote:
> On Mon, Nov 06, 2023 at 07:29:50PM +0000, Gavin Smith wrote:
> > On Sun, Nov 05, 2023 at 11:30:42AM +0000, Ihor Radchenko wrote:
> > > May someone please explain the correct usage of @anchor in the above
> > > example and why the warning is being thrown?
> > 
> > I don't think there's really much wrong with it.  We added more warnings
> > for nested commands, trying to define which commands should occur in
> > certain contexts.  We have given the @item command a class of
> > "contain_basic_inline", which excludes anchor commands, as well as
> > the cross-reference commands.
> > 
> > I don't remember, or never knew to start with, what the justification
> > was for giving @item this class.
> 
> I agree that accepting @anchor and @*ref on @item in @*table line would
> be ok.

There is actually a problem with @ftable and @vtable.  If you put an
@anchor on an @item line there, then it is the text of an index entry,
which is a real problem.


@node Top

@ftable @asis
@item AA @anchor{xy}
one

@item BB
two

@end ftable

@node Index

@printindex fn

@bye 

This gives the warnings:

test.texi:4: warning: @anchor should not appear on @item line
test.texi:4: @anchor output more than once: xy

The anchor is processed a second time when the index is output.  Adding
further @printindex commands results in the same error being output again.

A warning is also given for @anchor in other index commands, like @cindex,
so this is consistent.

When I have time, I will look at how the warning could be given for
@ftable and @vtable only.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.