On Thu, Sep 24, 2026 at 10:23:14PM +0200, Patrice Dumas wrote:
> On Thu, Sep 24, 2026 at 07:58:42PM +0100, Gavin Smith wrote:
> > On Sat, Aug 08, 2026 at 03:26:02PM +0200, Patrice Dumas wrote:
> > > On Thu, Jul 23, 2026 at 05:26:10PM +0100, Gavin Smith wrote:
> > > > That should be ok, as long as we avoid creating shadow targets if there
> > > > is an associated node (my patch to texinfo.tex avoided this).  Then
> > > > outputting a warning won't affect many existing manuals.
> > > 
> > > I have implemented the changes we discussed about.
> > 
> > Is there any way to get nodes added for lone sectioning commands rather
> > than anchors?
> > 
> > I tried running texi2any with "-c USE_NODES=0" but it made no difference.
> > Is there any way to configure this with USE_NODES or other variable?
> 
> Yes, with
> -c TREE_TRANSFORMATIONS=insert_nodes_for_sectioning_commands
> 
> I previously wanted to add another value for USE_NODES, but in the end
> using "-c TREE_TRANSFORMATIONS=insert_nodes_for_sectioning_commands"
> seems best to me.  The real question is whether we should make is the
> default.  In that case, maybe we could add a customization variable to
> avoid doing it.

I'd like to make it the default.

In my testing, the results of insert_nodes_for_sectioning_commands look ok,
although don't match exactly what I implemented in texinfo.tex.  In those
cases, texi2any issues warnings so at least users will be aware there is
a problem.

The main inconsistency is what is done when there are multiple sections
with the same names, which are having nodes added.  In the input below,
"@section two" occurs twice.

The results are inconsistent between with insert_nodes_for_sectioning_commands
and without, in the case of repeated lone sectioning commands with the same
argument, where there is no explicit node with that argument:

Input:

\input texinfo

@node First
@chapter First

@xref{two}.

@node foo
@chapter foo

Bbbbbbbbbbb.

@section two

CCCCCCC.

@node bar
@chapter bar

LLLLLLLLLLL.

@section two

DDDDDDDDD.


@bye


With insert_nodes_for_sectioning_commands, multiple nodes are created:
one called "two", and one called "two [+1+]".  "two" refers to the first
@section.

texi2any outputs these warnings:

shadow-repeated.texi:22: warning: @section `two' already added node
shadow-repeated.texi:13: warning: added for @section

Is it possible to add the disambiguation suffix to both created nodes,
so two nodes called "two [+1+]" and "two [+2+]" would be created, and
no node created "two" is created, for the reasons in my earlier email?

https://lists.gnu.org/archive/html/bug-texinfo/2026-07/msg00081.html

This is what already happens if there is also an explicit node by
the same name.

If it's not practical to implement, it should be ok, as at least there
are the warnings there.

Without insert_nodes_for_sectioning_commands, there is only one anchor
target created, called "two", for the first @section.  "two" refers to the
first @section.

I'd prefer it in this case, if no anchor target at all was created, or
if two anchors were created: "two [+1+]" and "two [+2+]".  These anchors
would be fairly useless, although it would be consistent with the
insert_nodes_for_sectioning_commands case.

In the texinfo.tex implementation, there is a warning printed and the
page number is omitted for the cross-reference.

l.8: Warning: ambiguous xref to two

(texinfo.tex warnings have never been very good so I don't think we need
to worry about trying to make the warnings consistent between texinfo.tex
and texi2any.)


Reply via email to