On Mon, Jul 20, 2026 at 06:46:32PM +0200, Patrice Dumas wrote:
> On Mon, Jul 20, 2026 at 02:19:17AM +0100, Gavin Smith wrote:
> > I've come back to this issue, and have an idea for how the need for a
> > @node line could be avoided in many cases.
> > 
> > My idea is that sectioning commands should create a so-called "shadow 
> > target"
> > (that's my working name, although there may be a better name):
> > 
> >   * If a section name appears once, and there is no @node (or @anchor
> >     or @namedanchor) using that name, then cross references to that
> >     section name go to that section.
> >   
> >   * If a section name is used twice or more, then the shadow targets
> >     created by those sections are disabled.  This prevents any ambiguity
> >     about which section a cross reference should go to.
> > 
> >   * If @node (or @anchor etc.) is used with the same name as a sectioning
> >     command, the @node (etc.) takes priority.
> > 
> > I believe this approach would be backwards-compatible with existing
> > documents.
> 
> > Hopefully this would be a welcomed modification to the language.  Any
> > comments?
> 
> This looks good to me.  Now that the @*heading are also associated to
> nodes, I think that it would make sense to have the same for those
> commands.  Sectioning @-commands that appear in contents could have
> precedence over @*heading commands.

I am not keen on it for @*heading, as this is confusing the purpose
of these commands - primarily to print a heading.  I know it does
do slightly more, in that a user can use a @node line followed by a
@heading line and the two will be associated, so the argument to @heading
could be used for cross-reference text if "@xrefautomaticsectiontitle on"
is given (in Texinfo 7.3, at least).

As you explain it, as a language feature it doesn't seem like it would
conflict with anything.  However, it would be more complexity to implement,
especially in texinfo.tex, and also makes the feature more complicated
for users to understand (as we would have three levels of priority, rather
than two).

Can we just do it for sectioning commands to start with and see where that
takes us?

> What about the other effect of @node, the delimitation of output units?
> It is not relevant for Texinfo TeX, but the implementation in texi2any
> would be quite different if it is like the
> insert_nodes_for_sectioning_commands tree transformation, or selecting
> some sectioning or @heading @-command as targets.

I'd imagine it would be governed by a variable like USE_NODES: we would
either split at explicit @node lines only, or at either a @node or sectioning
command without an associated @node line.

My preference would be to make the latter the default, while allowing the
former to allow users to have fine-grained control over node splitting.
(See message from Per Bothner, 2021-10-09 "control over sectioning
and splitting"
<https://lists.gnu.org/archive/html/bug-texinfo/2021-10/msg00000.html>.)
The former would be closer to the current behaviour AFAIK.

We could use USE_NODES for this purpose or another variable if USE_NODES
isn't quite right.  You explained a possible use of USE_NODES in this
message:

On Sun, Feb 16, 2025 at 02:53:05PM +0100, [email protected] wrote:
> > What would be the advantage to a user of setting USE_NODES=0?
>
> If there are lone nodes, they are associated to the preceding section.
> It allows to have HTML more book like, while Info could have more @node
> units.  I am not sure that it is often used, but it was important enough
> as a difference that it was how texi2html was designed in th eearly 2000.
>
> Setting USE_NODES=0 also has some other effects on whether node or
> sectioning command are used as names for some links.  But it is a
> different matter that is not relevant here.

> > (We could also consider allowing automatic anchors to index entries.
> > (I did find an email about this - Robert Weiner, 2016-07-01 "Is it possible
> > to make a Texinfo cross-reference to an index item?"  Quoted below in
> > Annex B.)  This should probably be enabled explicitly with an option, 
> > otherwise
> > too many targets would be created.)
> > 
> > https://lists.gnu.org/archive/html/help-texinfo/2016-07/msg00000.html
> 
> I am less convinced about this need.  One can use a regular @anchor with
> the same name as the index entry.  This adds information duplication,
> but for a very specific need, which is fine.

Agreed.


> 
> -- 
> Pat

Reply via email to