On Mon, Feb 17, 2025 at 07:13:43PM +0000, Gavin Smith wrote:
> On Mon, Feb 17, 2025 at 07:37:23PM +0100, pertu...@free.fr wrote:
> > 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.
> 
> Here is an alternative:
> 
> @node my node
> @xrefname{my node}@c
> 
> @quotation
> a quotation
> @end quotation
> 
> @heading heading
> 
> The @xrefname would set the label text for linking to the last node or anchor.
> Here it would take priority over "@heading" as it occurs earlier, and takes
> the place of a section command, but does not produce a heading or anything
> else.

For such a command, that is not supposed to be inline, I would propose a
line command.

I think that it is a possibility that has value in addition to that use,
it could be a way to add the name of a node to be used for various
purposes independently of the actual heading or sectioning (and for
other purposes than the one we are discussing here).  I see it as
something similar to nodedescription, but for the node name/title/label.
For example, it could be used for the name in an automatically generated
menu.  And, of course, the heading or sectioning command following the
node would be a relevant default if it is not specified.

The only issue I see, which is probably minor at that point, is that it
is not backward compatible, it needs to be added to manuals to get an
optimal rendering.  This is not such a big issue, though, as the setting
we are talking about should be very rare in actual manuals as most
manuals simply use the @node associated with sectioning (or maybe
heading) command following next, and my guess is that @*heading commands
are used relatively rarely.  Also, if deemed necessary, we could
add an @-command for that backward compatibility, like:
  @txiheadingnotassociatedtonode on/off
But I do not think that it would really be needed.

> With xrefautomaticsectiontitle on, (or similar setting that we introduce),
> this command would often not be needed.

This command would not be needed more generally than for xref name
related purposes, because the default would be specified by the
following heading/sectioning command in the vast majority of cases.

> The user could also specify "@xrefautomaticsectiontitle on" and
> "@xrefautomaticsectiontitle off" throughout the manual to get the
> desired effect.
> 
> For links to anchors, the @xrefname would follow the @anchor:
> 
> @anchor{Butterfly}@xrefname{Papilon}.

I really dislike this possibility.  For one thing, I think that an
inline version should be a different command.  However, my feeling is that
having a separate command with both the anchor and associated name would
be better in term of consistency of the language.  I think that
associating inline braced commands based on their relative location is
not something we should start doing unless we have used all the other
possibilities.  Based on nesting is more ok, though it is also better to
avoid if possible.

> This mirrors the order of @node and @section, with @section providing
> the cross-reference text:
> 
> @node node
> @section section
> 
> Now I just need to fiddle with texinfo.tex to see if this is possible.
> (I think what I said before about it not being possible with @anchor
> was wrong).

Reply via email to