On Tue, Nov 10, 2026 at 10:35:44PM +0100, Patrice Dumas wrote:
> > I have not thought of a good solution to this, other than setting
> > AUTO_SECTION_NODE=0 by default for Info. Another acceptable solution
> > could be to automatically output a menu in such a situation, like:
> >
> > * Menu:
> >
> > * Introduction::
> >
> > At least then a reader of the manual could navigate to the Introduction
> > node.
>
> I do not think that this would be a good solution. To me the intent here
> is to have @unnumbered and associated text be part of the Top node in
> Info (and HTML). It corresponds to the "Node Command Regions" new node
> situation in the manual. To me this can only be correctly rendered with
> AUTO_SECTION_NODE=0.
>
> There will be manuals in the wild that need AUTO_SECTION_NODE=0 to be
> rendered as intended, as the authors used a sectioning command without
> node such that it appears in one node only, which goes against the
> output obtained with AUTO_SECTION_NODE=1.
>
> Either we prefer keeping backward compatibility for such manuals, or we
> prefer allowing users to avoid putting nodes that have the same names as
> sectioning commands, but we can't have both.
I think we should do something because the Info file is pretty much unusable.
The user could manually navigate to the "Introduction" node (with the "g"
command) but they would have no reason to know to do this.
The Info output from the manual does not have to be perfect but the user of the
manual should at least be able to find their way through it.
Probably, the manual should have used @chapheading instead of @unnumbered.
texi2any may have accepted the lone @unnumbered command without any warning
and so the authors of the document didn't realise that they had used the
wrong command.
This problem occurs in any node with explicit node pointers (so probably
older Texinfo files), where a sectioning command is used to provide a heading.
The rest of the node after the heading becomes inaccessible.
It seems quite possible to me that this construct occurs in other Texinfo
manuals.
We should look for a way to support such manuals better with
AUTO_SECTION_NODE=1 by adding a cross-reference or menu entry to the main
node in clearly defined limited situations where this problem occurs.
If desired, we can invent a new customization variable to control this.
This would be in nodes with explicit pointers given in @node, and which do
not have a @menu. The nodes we need to reference are those created with
AUTO_SECTION_NODE, i.e. those without an explicit @node line. We can further
restrict this to sectioning commands at a lower level - i.e. @unnumbered in
the @top node, or @section in a @chapter node. This is because people using
sectioning commands for headings would be unlikely to use a higher or equal
level of sectioning command to that of the node they are in.
I found there would be good results in my test files by simply changing
"@node Top, Location, (dir), (dir)" to "@node Top": removing the explicit
pointers. So it should be possible to use the existing automatic generation
of menus and add a condition where this should be used even if there
are explicit pointers.
An initial patch to do this is at the end of this email. It is in the
Perl code for the Plaintext formatter where manus are added. There is
an attempt to check if the node associated with the first section which is
a child was automatically added.
I couldn't see an obvious way of doing this so I did it by checking that
the line number was the same for the @node command as for the sectioning
command, based on the following in Texinfo/ManipulateTreeNonXS.pm:
# In general there is a source info for the associated command, there
# may be none for generated sectioning commands, for example for fill
# gaps in sectioning.
# Using the source information of the associated command for the node
# is not perfect, but it is better than no source info.
if (defined($associated_command->{'source_info'})) {
$node->{'source_info'} = { %{$associated_command->{'source_info'}} };
}
There may be a simpler/easier way of doing this check.
I confirmed that with my change, with an explicit @node before
"@unnumbered Introduction", that a menu would not be generated in the
Top node.
With this change, the output from the test file I sent looks like this
(tested with "TEXINFO_XS=omit ../tta/perl/texi2any.pl mtools-fail.texi"):
-----------------------------------------
File: mtools-fail.info, Node: Top, Next: Location, Prev: (dir), Up: (dir)
Mtools doc
**********
This is mtools' documentation.
* Menu:
* Introduction::
* Location::
-- The Detailed Node Listing --
Introduction
* Location:: Where to find mtools and early bug fixes
File: mtools-fail.info, Node: Introduction, Next: Location, Up: Top
Introduction
************
Mtools is a collection of tools to allow Unix systems to manipulate
MS-DOS files: read, write, and move around files on an MS-DOS file
system (typically a floppy disk). Where reasonable, each program
attempts to emulate the MS-DOS equivalent command. However, unnecessary
restrictions and oddities of DOS are not emulated. For instance, it is
possible to move subdirectories from one subdirectory to another.
* Menu:
* Location:: Where to find mtools and early bug fixes
File: mtools-fail.info, Node: Location, Prev: Top, Up: Top
1 Where to get mtools
*********************
-----------------------------------------
It's slightly badly structured, but not a major problem. There are also
some warnings output by texi2any about the structure of the manual, telling
the user that there is a problem.
If this looks good I can try to finish this patch (there are more messages
printed with the full mtools.texi file like the below, but I haven't
investigated
these).
BUG: format_line_message: error_location_info undef at
../tta/perl//../perl/Texinfo/Report.pm line 65.
Texinfo::Report::format_line_message("warning", "menu entry node name
should not contain `:'", undef, undef, 0) called at
../tta/perl//../perl/Texinfo/Convert/ConverterNonXS.pm line 224
Texinfo::Convert::Converter::converter_line_warn(Texinfo::Convert::Info=HASH(0x575a55179128),
"menu entry node name should not contain `:'", undef) called at
../tta/perl//../perl/Texinfo/Convert/PlaintextNonXS.pm line 974
Texinfo::Convert::Plaintext::plaintext_line_warn(Texinfo::Convert::Info=HASH(0x575a55179128),
Texinfo::Convert::Info=HASH(0x575a55179128), "menu entry node name should not
contain `:'", undef) called at
../tta/perl//../perl/Texinfo/Convert/PlaintextNonXS.pm line 4178
Texinfo::Convert::Plaintext::_convert(Texinfo::Convert::Info=HASH(0x575a55179128),
Texinfo::TreeElement=HASH(0x575a5525b880)) called at
../tta/perl//../perl/Texinfo/Convert/PlaintextNonXS.pm line 4406
Here is the patch:
diff --git a/tta/perl/Texinfo/Convert/PlaintextNonXS.pm
b/tta/perl/Texinfo/Convert/PlaintextNonXS.pm
index 3c9736d025..fddd318144 100644
--- a/tta/perl/Texinfo/Convert/PlaintextNonXS.pm
+++ b/tta/perl/Texinfo/Convert/PlaintextNonXS.pm
@@ -4631,8 +4631,12 @@ sub _convert($$) {
my $node = $self->{'current_node'};
my $arguments_line = $node->{'contents'}->[0];
my $automatic_directions = (scalar(@{$arguments_line->{'contents'}}) <=
1);
+
+ my $orphaned_nodes = 0;
+
if (exists($node->{'extra'}) and $node->{'extra'}->{'node_number'}
- and $automatic_directions and !$self->{'seenmenus'}->{$node}) {
+ #and $automatic_directions
+ and !$self->{'seenmenus'}->{$node}) {
my $identifiers_target = $self->{'document'}->labels_information();
my $nodes_list = $self->{'document'}->nodes_list();
my $sections_list = $self->{'document'}->sections_list();
@@ -4640,6 +4644,23 @@ sub _convert($$) {
my $node_relations
= $nodes_list->[$node->{'extra'}->{'node_number'} -1];
+ if (exists($node_relations->{'associated_section'})) {
+ my $associated_relations = $node_relations->{'associated_section'};
+
+ if (exists($associated_relations->{'section_children'})
+ and scalar(@{$associated_relations->{'section_children'}}) > 0) {
+ my $first_section_child
+ = $associated_relations->{'section_children'}->[0];
+ my $first_section_child_node =
$first_section_child->{'associated_node'};
+ if ($first_section_child->{'element'}->{'source_info'}->{'line_nr'}
+ ==
$first_section_child_node->{'element'}->{'source_info'}->{'line_nr'}) {
+ $orphaned_nodes = 1;
+ }
+ }
+ }
+
+ if ($automatic_directions or $orphaned_nodes) {
+
$self->{'seenmenus'}->{$node} = 1;
my $format_menu = $self->get_conf('FORMAT_MENU');
my $menu_node;
@@ -4660,6 +4681,8 @@ sub _convert($$) {
_convert($self, $menu_node);
_add_newline_if_needed($self);
}
+
+ }
}
}