On Sun, Feb 16, 2025 at 04:52:16PM +0000, Gavin Smith wrote:
> On Sun, Feb 16, 2025 at 04:56:37PM +0100, [email protected] wrote:
> > What should we do for @*heading not at the top level, like
> > 
> > @node node
> > 
> > @quotation
> > @heading in quitation
> > Quote
> > @end quotation
> > 
> > @heading at top-level
> 
> This is actually a problem for an implementation in texinfo.tex.
> 
> In your example, the @heading commands should not be associated with
> the @node.  All they should do is produce headings.
> 
> If we made @heading immediately following a @node associated with the
> node, in that the @heading text could be used for cross-references to
> the @node, then it would not be possible to tell if any text had intervened.
>
> The way this is done in texinfo.tex for @section is that the @node command
> sets a \lastnode variable, which is then used and cleared the next time
> a @section command is seen.  This is not a problem as @section is only
> expected to appear immediately after a @node, whereas @heading could
> appear anywhere.

I do not think that it is an issue if an @anchorname is wanted/used, as
the user should just know that a lone @anchorname is undefined
behaviour.  For @node this is problematic, I think that we do not want
to prevent lone nodes, in particular because of their role as output
unit delimiters.

> In terms of the @anchorname or @label feature we were discussing (under
> various names), this means it may less problematic to use this with
> @section:
> 
> @anchorname name 
> @section section
> 
> than with @heading:
> 
> @anchorname name 
> @heading heading
> 
> This means we lose the ability to control whether the command is in
> a table of contents, which may not be significant.

I don't see the issue here.  If a lone @anchorname is provided, it is
undefined behaviour and that's it.

> We could provide some other means of providing the printed xref name
> for @node with @heading:
> 
> @node node
> @heading heading
>
> This could be done with some new command.  We could even use the @heading
> text, but only if the user has explicitly requested it, not by default.

In texi2any, it is actually checked that the @heading follows the @node
and that only non formatted @-commands or empty lines are seen.

One possibility would be to use @anchorname only with @*heading, but
this means that we would have

  @node my node

  @anchorname my node2
  @heading my node

which is not good.

One possibility, which is not very acceptable either would be to allow
an empty @anchorname to remove the link between a @node and @heading,
for example

  @node my node

  @quotation
   a quotation
  @end quotation

  @anchorname
  @heading heading

but it is not very appealing either for many reasons.

-- 
Pat

Reply via email to