texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Index commands do not end paragraphs in texi2any


From: Patrice Dumas
Subject: branch master updated: Index commands do not end paragraphs in texi2any
Date: Tue, 21 Mar 2023 18:51:39 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 151fc2da76 Index commands do not end paragraphs in texi2any
151fc2da76 is described below

commit 151fc2da7640b8fb0be53b4ee119a1f02814eddd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Mar 21 23:51:05 2023 +0100

    Index commands do not end paragraphs in texi2any
    
    * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
    tp/Texinfo/XS/parsetexi/indices.c (add_index_command): do not set
    index commands as close_paragraph.
---
 ChangeLog                                          |   8 +
 tp/Texinfo/ParserNonXS.pm                          |   6 +-
 tp/Texinfo/XS/parsetexi/indices.c                  |   3 +-
 .../results/converters_tests/at_commands_in_raw.pl |  78 ++---
 .../indices_in_begin_tables_lists.pl               | 128 +++----
 .../res_docbook/indices_in_begin_tables_lists.xml  |   8 +-
 .../res_info/indices_in_begin_tables_lists.info    | Bin 3264 -> 3264 bytes
 .../res_xml/indices_in_begin_tables_lists.xml      |   8 +-
 tp/t/results/coverage/multitable.pl                |  68 ++--
 .../coverage_braces/contain_plain_text_nestings.pl | 298 ++++++++--------
 tp/t/results/float/cindex_in_caption.pl            |  76 ++---
 tp/t/results/float/complex_float.pl                | 240 ++++++-------
 tp/t/results/formats_encodings/sample_utf8.pl      | 188 +++++-----
 .../res_html/DiYiZhang_0028First-Chapter_0029.html |   4 +-
 .../sample_utf8/res_info/sample_utf8.info          | Bin 2082 -> 2082 bytes
 tp/t/results/indices/index_entries_locations.pl    | 173 +++++-----
 tp/t/results/indices/index_entry_in_footnote.pl    | Bin 7163 -> 7323 bytes
 .../index_entry_in_footnote_different_node_end.pl  |  78 ++---
 .../indices/index_entry_in_footnote_sections.pl    |  71 ++--
 .../index_entry_in_footnote_sections_separate.pl   |  71 ++--
 .../indices/index_entry_in_footnote_separate.pl    |  78 ++---
 tp/t/results/indices/index_no_node.pl              | 180 +++++-----
 .../indices/index_no_node/res_html/Chapter.html    |   4 +-
 .../indices/index_no_node/res_html/index.html      |   4 +-
 .../indices/index_no_node/res_html/unnumbered.html |   4 +-
 tp/t/results/indices/index_no_node_no_top.pl       | 204 +++++------
 .../indices/index_no_node_no_top_no_node.pl        | 204 +++++------
 tp/t/results/indices/index_nodes.pl                | 252 +++++++-------
 .../indices/index_nodes/res_html/chap-first.html   |   4 +-
 .../indices/index_nodes/res_info/index_nodes.info  | Bin 4196 -> 4196 bytes
 .../indices/index_nodes/res_plaintext/a-node.txt   |  12 +-
 .../index_nodes/res_plaintext/chap-first.txt       |   6 +-
 .../indices/index_nodes/res_plaintext/second.txt   |   2 +-
 .../indices/index_nodes_no_split_no_use_nodes.pl   | 252 +++++++-------
 .../res_html/index_nodes.html                      |   4 +-
 .../index_nodes_no_split_no_use_nodes.txt          |  20 +-
 tp/t/results/indices/index_split.pl                | 252 +++++++-------
 .../indices/index_split/res_html/first.html        |   4 +-
 .../indices/index_split_split_chapter_no_nodes.pl  | 252 +++++++-------
 .../res_html/first.html                            |   4 +-
 tp/t/results/indices/index_table.pl                |  78 ++---
 .../res_html/node-with-ftable-and-vtable.html      |   4 +-
 .../indices/index_table/res_info/index_table.info  | Bin 21242 -> 21242 bytes
 .../index_table/res_plaintext/index_table.txt      |   4 +-
 .../results/indices/index_table_chapter_no_node.pl |  78 ++---
 .../res_html/node-with-ftable-and-vtable.html      |   4 +-
 .../res_plaintext/indices-refs.txt                 |   2 +-
 .../res_plaintext/node-with-printindex.txt         |   2 +-
 tp/t/results/indices/nodes_before_top.pl           | 190 +++++------
 .../nodes_before_top/res_html/chap-first.html      |   4 +-
 .../nodes_before_top_and_sections_chapter.pl       | 190 +++++------
 .../res_html/index.html                            |   4 +-
 ...odes_before_top_and_sections_chapter_no_node.pl | 190 +++++------
 .../res_html/index.html                            |   4 +-
 ...des_before_top_and_sections_unsplit_no_nodes.pl | 190 +++++------
 .../res_html/nodes_before_top_and_sections.html    |   4 +-
 .../indices/nodes_before_top_split_chapter.pl      | 190 +++++------
 .../res_html/first-before-top.html                 |   4 +-
 .../nodes_before_top_split_chapter_no_nodes.pl     | 190 +++++------
 .../res_html/index.html                            |   4 +-
 ...rintindex_index_entry_in_copying_in_footnote.pl |  74 ++--
 tp/t/results/indices/split_chapter_index.pl        | 256 +++++++-------
 .../split_chapter_index/res_html/first.html        |   4 +-
 .../indices/unknown_then_known_index_entry.pl      |  60 ++--
 tp/t/results/info_tests/before_node_and_section.pl |  80 ++---
 .../multitable_anchor_and_index_entry.pl           | 181 +++++-----
 .../info_tests/nested_multitable_anchor_index.pl   | 128 +++----
 .../info_tests/one_node_counted_elements.pl        | 130 +++----
 tp/t/results/info_tests/test_index.pl              | 378 ++++++++++-----------
 tp/t/results/invalid_nestings/tab_in_index.pl      |  74 ++--
 .../itemize/inter_item_commands_in_enumerate.pl    |  64 ++--
 .../itemize/inter_item_commands_in_itemize.pl      |  64 ++--
 .../inter_item_commands_in_multitable.pl           | 128 +++----
 .../at_commands_glued_in_paragraph.pl              |  60 ++--
 .../res_parser/formatting_chm/chapter.html         |   4 +-
 .../res_parser/formatting_docbook/formatting.xml   |  16 +-
 .../EPUB/xhtml/chapter.xhtml                       |   4 +-
 .../res_parser/formatting_html32/formatting.html   |   4 +-
 .../formatting_html_no_split/formatting.html       |   4 +-
 .../res_parser/formatting_info/formatting.info     |  10 +-
 .../res_parser/formatting_plaintext/formatting.txt |  10 +-
 .../res_parser/formatting_xhtml/formatting.html    |   4 +-
 .../res_parser/formatting_xml/formatting.xml       |  16 +-
 .../formatting_enable_encoding/formatting.html     |   4 +-
 .../EPUB/xhtml/formatting_fot.xhtml                |   4 +-
 .../res_parser/formatting_exotic/chapter.html      |   4 +-
 .../res_parser/formatting_fr/formatting.html       |   4 +-
 .../res_parser/formatting_fr_icons/formatting.html |   4 +-
 .../res_parser/formatting_fr_info/formatting.info  |  10 +-
 .../formatting.info                                |  10 +-
 .../formatting.info                                |  10 +-
 .../formatting_inline_css/formatting.html          |   4 +-
 .../res_parser/formatting_mathjax/formatting.html  |   4 +-
 .../formatting_numerical_entities/formatting.html  |   4 +-
 .../formatting.txt                                 |  10 +-
 .../formatting_sort_element_counts/formatting.html |   4 +-
 .../formatting_texi2html/formatting.html           |   4 +-
 .../formatting_texi2html_nodes/formatting_fot.html |   4 +-
 .../formatting_weird_quotes/formatting.html        |   4 +-
 .../res_parser/formatting_singular/sing_fot.htm    |   4 +-
 100 files changed, 3210 insertions(+), 3219 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 46c4e1df07..92bc4d6325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-03-21  Patrice Dumas  <pertusus@free.fr>
+
+       Index commands do not end paragraphs in texi2any
+
+       * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/indices.c (add_index_command): do not set
+       index commands as close_paragraph.
+
 2023-03-21  Gavin Smith <gavinsmith0123@gmail.com>
 
        Index commands do not end paragraphs
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index bb8770b7aa..eeb3240fb2 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -386,7 +386,7 @@ my %default_basic_inline_commands = 
%contain_basic_inline_commands;
 foreach my $index (keys(%index_names)) {
   my $one_letter_prefix = substr($index, 0, 1);
   foreach my $prefix ($index, $one_letter_prefix) {
-    $default_close_paragraph_commands{$prefix.'index'} = 1;
+    #$default_close_paragraph_commands{$prefix.'index'} = 1;
     $default_basic_inline_commands{$prefix.'index'} = 1;
     $default_no_paragraph_commands{$prefix.'index'} = 1;
   }
@@ -7194,7 +7194,7 @@ sub _parse_line_command_args($$$)
       delete $self->{'aliases'}->{$cmd_name};
       # unset @def*index effect
       delete $self->{'line_commands'}->{$cmd_name};
-      delete $self->{'close_paragraph_commands'}->{$cmd_name};
+      #delete $self->{'close_paragraph_commands'}->{$cmd_name};
       delete $self->{'no_paragraph_commands'}->{$cmd_name};
       delete $self->{'basic_inline_commands'}->{$cmd_name};
       delete $self->{'command_index'}->{$cmd_name};
@@ -7260,7 +7260,7 @@ sub _parse_line_command_args($$$)
         delete $self->{'brace_commands'}->{$index_cmdname};
         delete $self->{'valid_nestings'}->{$index_cmdname};
         $self->{'line_commands'}->{$index_cmdname} = 'line';
-        $self->{'close_paragraph_commands'}->{$index_cmdname} = 1;
+        #$self->{'close_paragraph_commands'}->{$index_cmdname} = 1;
         $self->{'no_paragraph_commands'}->{$index_cmdname} = 1;
         $self->{'basic_inline_commands'}->{$index_cmdname} = 1;
         $self->{'command_index'}->{$index_cmdname} = $name;
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index 855c5cf916..7f76a1685e 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -72,7 +72,8 @@ add_index_command (char *cmdname, INDEX *idx)
   enum command_id new = add_texinfo_command (cmdname);
   user_defined_command_data[new & ~USER_COMMAND_BIT].flags
     |= CF_line | CF_index_entry_command | CF_contain_basic_inline
-      | CF_close_paragraph | CF_no_paragraph;
+    /*  | CF_close_paragraph */
+      | CF_no_paragraph;
   user_defined_command_data[new & ~USER_COMMAND_BIT].data = LINE_line;
   associate_command_to_index (new, idx);
 }
diff --git a/tp/t/results/converters_tests/at_commands_in_raw.pl 
b/tp/t/results/converters_tests/at_commands_in_raw.pl
index 2113a5e5d7..96cb75c9d2 100644
--- a/tp/t/results/converters_tests/at_commands_in_raw.pl
+++ b/tp/t/results/converters_tests/at_commands_in_raw.pl
@@ -776,46 +776,46 @@ $result_trees{'at_commands_in_raw'} = {
             {
               'text' => '.
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fentry2'
+                  'contents' => [
+                    {
+                      'text' => 'fentry2'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 72,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 72,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1081,7 +1081,7 @@ $result_trees{'at_commands_in_raw'} = {
 };
 
$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[13]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[13]{'contents'}[0]{'args'}[0]{'contents'}[0];
 
$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[16]{'extra'}{'element_node'}
 = $result_trees{'at_commands_in_raw'}{'contents'}[3];
+$result_trees{'at_commands_in_raw'}{'contents'}[4]{'contents'}[15]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'at_commands_in_raw'}{'contents'}[3];
 
 $result_texis{'at_commands_in_raw'} = '@node Top
 @top top
@@ -1477,7 +1477,7 @@ $result_converted{'plaintext'}->{'at_commands_in_raw'} = 
'top
 
 * Menu:
 
-* fentry2:                               chap.                 (line 17)
+* fentry2:                               chap.                 (line 16)
 
    FF.
 
@@ -1530,8 +1530,8 @@ $result_converted{'html_text'}->{'at_commands_in_raw'} = 
'<div class="top-level-
 <p>See <a class="xref" href="#anchor-in-html">anchor in html</a>.
 </p>
 <p>&lsquo;anchor in tex&rsquo;.
-</p><a class="index-entry-id" id="index-fentry2"></a>
-
+<a class="index-entry-id" id="index-fentry2"></a>
+</p>
 <p>newidx entry
 </p>
 <div class="printindex fn-printindex">
@@ -1639,8 +1639,8 @@ Some \\arg\\.
 <para><xref label="anchor-in-html"><xrefnodename>anchor in 
html</xrefnodename></xref>.
 </para>
 <para><ref label="anchor-in-tex"><xrefnodename>anchor in 
tex</xrefnodename></ref>.
-</para><findex index="fn" spaces=" "><indexterm index="fn" 
number="1">fentry2</indexterm></findex>
-
+<findex index="fn" spaces=" "><indexterm index="fn" 
number="1">fentry2</indexterm></findex>
+</para>
  <para>newidx entry
 </para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
@@ -1678,8 +1678,8 @@ $result_converted{'docbook'}->{'at_commands_in_raw'} = 
'<chapter label="1" id="c
 <para>See <link linkend="anchor-in-html">anchor in html</link>.
 </para>
 <para><link linkend="anchor-in-tex">anchor in tex</link>.
-</para><indexterm role="fn"><primary>fentry2</primary></indexterm>
-
+<indexterm role="fn"><primary>fentry2</primary></indexterm>
+</para>
 <para>newidx entry
 </para>
 <index role="cp"></index>
diff --git a/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
index febbd65689..a9af99d9a5 100644
--- a/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
+++ b/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
@@ -562,46 +562,46 @@ $result_trees{'indices_in_begin_tables_lists'} = {
                     {
                       'text' => 'T--ext before items.
 '
-                    }
-                  ],
-                  'type' => 'paragraph'
-                },
-                {
-                  'args' => [
+                    },
                     {
-                      'contents' => [
+                      'args' => [
                         {
-                          'text' => 'also a cindex in itemize'
+                          'contents' => [
+                            {
+                              'text' => 'also a cindex in itemize'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
                         }
                       ],
+                      'cmdname' => 'cindex',
+                      'extra' => {
+                        'element_node' => {},
+                        'index_entry' => [
+                          'cp',
+                          4
+                        ]
+                      },
                       'info' => {
-                        'spaces_after_argument' => {
-                          'text' => '
-'
+                        'spaces_before_argument' => {
+                          'text' => ' '
                         }
                       },
-                      'type' => 'line_arg'
+                      'source_info' => {
+                        'file_name' => 'indices_in_begin_tables_lists.texi',
+                        'line_nr' => 25,
+                        'macro' => ''
+                      },
+                      'type' => 'index_entry_command'
                     }
                   ],
-                  'cmdname' => 'cindex',
-                  'extra' => {
-                    'element_node' => {},
-                    'index_entry' => [
-                      'cp',
-                      4
-                    ]
-                  },
-                  'info' => {
-                    'spaces_before_argument' => {
-                      'text' => ' '
-                    }
-                  },
-                  'source_info' => {
-                    'file_name' => 'indices_in_begin_tables_lists.texi',
-                    'line_nr' => 25,
-                    'macro' => ''
-                  },
-                  'type' => 'index_entry_command'
+                  'type' => 'paragraph'
                 }
               ],
               'type' => 'before_item'
@@ -1214,46 +1214,46 @@ $result_trees{'indices_in_begin_tables_lists'} = {
                     {
                       'text' => 'Title
 '
-                    }
-                  ],
-                  'type' => 'paragraph'
-                },
-                {
-                  'args' => [
+                    },
                     {
-                      'contents' => [
+                      'args' => [
                         {
-                          'text' => 'cindex'
+                          'contents' => [
+                            {
+                              'text' => 'cindex'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
                         }
                       ],
+                      'cmdname' => 'cindex',
+                      'extra' => {
+                        'element_node' => {},
+                        'index_entry' => [
+                          'cp',
+                          8
+                        ]
+                      },
                       'info' => {
-                        'spaces_after_argument' => {
-                          'text' => '
-'
+                        'spaces_before_argument' => {
+                          'text' => ' '
                         }
                       },
-                      'type' => 'line_arg'
+                      'source_info' => {
+                        'file_name' => 'indices_in_begin_tables_lists.texi',
+                        'line_nr' => 56,
+                        'macro' => ''
+                      },
+                      'type' => 'index_entry_command'
                     }
                   ],
-                  'cmdname' => 'cindex',
-                  'extra' => {
-                    'element_node' => {},
-                    'index_entry' => [
-                      'cp',
-                      8
-                    ]
-                  },
-                  'info' => {
-                    'spaces_before_argument' => {
-                      'text' => ' '
-                    }
-                  },
-                  'source_info' => {
-                    'file_name' => 'indices_in_begin_tables_lists.texi',
-                    'line_nr' => 56,
-                    'macro' => ''
-                  },
-                  'type' => 'index_entry_command'
+                  'type' => 'paragraph'
                 }
               ],
               'type' => 'before_item'
@@ -3878,12 +3878,12 @@ 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[1]{'ex
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[3]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[3]{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[3]{'extra'}{'command_as_argument'}
 = 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[3]{'args'}[0]{'contents'}[0];
-$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[5]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
+$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[5]{'extra'}{'command_as_argument'}
 = 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'}[0];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[9]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[13]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
-$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
+$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[17]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[17]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
 
$result_trees{'indices_in_begin_tables_lists'}{'contents'}[4]{'contents'}[17]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'indices_in_begin_tables_lists'}{'contents'}[3];
diff --git 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_docbook/indices_in_begin_tables_lists.xml
 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_docbook/indices_in_begin_tables_lists.xml
index 03a48707c0..f1fcd3c5a0 100644
--- 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_docbook/indices_in_begin_tables_lists.xml
+++ 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_docbook/indices_in_begin_tables_lists.xml
@@ -18,8 +18,8 @@
 </para></listitem></itemizedlist>
 <itemizedlist><!-- comment in itemize -->
 <para>T&#8211;ext before items.
-</para><indexterm role="cp"><primary>also a cindex in 
itemize</primary></indexterm>
-<listitem><para>bullet item
+<indexterm role="cp"><primary>also a cindex in itemize</primary></indexterm>
+</para><listitem><para>bullet item
 </para></listitem></itemizedlist>
 <orderedlist numeration="arabic">
 <!-- comment before first item in enumerate -->
@@ -39,8 +39,8 @@
 <listitem><para>enumerate item
 </para></listitem></orderedlist>
 <orderedlist numeration="arabic"><para>Title
-</para><indexterm role="cp"><primary>cindex</primary></indexterm>
-<listitem><para>enum
+<indexterm role="cp"><primary>cindex</primary></indexterm>
+</para><listitem><para>enum
 </para></listitem></orderedlist>
 <orderedlist numeration="arabic"><indexterm role="cp"><primary>first 
idx</primary></indexterm>
 <!-- comment -->
diff --git 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_info/indices_in_begin_tables_lists.info
 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_info/indices_in_begin_tables_lists.info
index 792a41ea84..2c8bd2b3a3 100644
Binary files 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_info/indices_in_begin_tables_lists.info
 and 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_info/indices_in_begin_tables_lists.info
 differ
diff --git 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_xml/indices_in_begin_tables_lists.xml
 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_xml/indices_in_begin_tables_lists.xml
index ba6a38f805..48f3b2365f 100644
--- 
a/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_xml/indices_in_begin_tables_lists.xml
+++ 
b/tp/t/results/converters_tests/indices_in_begin_tables_lists/res_xml/indices_in_begin_tables_lists.xml
@@ -27,8 +27,8 @@
 <itemize commandarg="bullet" automaticcommandarg="on" endspaces=" 
"><itemprepend><formattingcommand command="bullet" 
automatic="on"/></itemprepend>
 <beforefirstitem><!-- c comment in itemize -->
 <para>T&textndash;ext before items.
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="4">also a 
cindex in itemize</indexterm></cindex>
-</beforefirstitem><listitem><prepend>&bullet;</prepend> <para>bullet item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="4">also a cindex 
in itemize</indexterm></cindex>
+</para></beforefirstitem><listitem><prepend>&bullet;</prepend> <para>bullet 
item
 </para></listitem></itemize>
 
 <enumerate first="1" endspaces=" ">
@@ -58,8 +58,8 @@
 
 <enumerate first="1" endspaces=" ">
 <beforefirstitem><para>Title
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="8">cindex</indexterm></cindex>
-</beforefirstitem><listitem> <para>enum
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="8">cindex</indexterm></cindex>
+</para></beforefirstitem><listitem> <para>enum
 </para></listitem></enumerate>
 
 <enumerate first="1" endspaces=" ">
diff --git a/tp/t/results/coverage/multitable.pl 
b/tp/t/results/coverage/multitable.pl
index a0bd87c6fa..1c67e7a6e5 100644
--- a/tp/t/results/coverage/multitable.pl
+++ b/tp/t/results/coverage/multitable.pl
@@ -233,45 +233,45 @@ $result_trees{'multitable'} = {
                             {
                               'text' => 'multitable tab 2
 '
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'index entry within multitable'
+                                  'contents' => [
+                                    {
+                                      'text' => 'index entry within multitable'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'cindex',
+                              'extra' => {
+                                'index_entry' => [
+                                  'cp',
+                                  1
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 7,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
                             }
                           ],
-                          'cmdname' => 'cindex',
-                          'extra' => {
-                            'index_entry' => [
-                              'cp',
-                              1
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 7,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
@@ -615,8 +615,8 @@ $result_converted{'xml'}->{'multitable'} = '
 </para></entry></row></thead><tbody><row><entry command="item"> 
<para>mu&textndash;ltitable item </para></entry><entry command="tab"> 
<para>multitable tab
 <!-- c comment in multitable -->
 </para></entry></row><row><entry command="item"> <para>mu&textndash;ltitable 
item 2 </para></entry><entry command="tab"> <para>multitable tab 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry within multitable</indexterm></cindex>
-</entry></row><row><entry command="item"> <para>lone mu&textndash;ltitable item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index entry 
within multitable</indexterm></cindex>
+</para></entry></row><row><entry command="item"> <para>lone 
mu&textndash;ltitable item
 </para></entry></row></tbody></multitable>
 
 <multitable spaces=" " endspaces=" "><columnprototypes><columnprototype 
bracketed="on">truc</columnprototype> <columnprototype 
bracketed="on">bidule</columnprototype></columnprototypes>
@@ -646,8 +646,8 @@ $result_converted{'docbook'}->{'multitable'} = '
 </para></entry></row></thead><tbody><row><entry><para>mu&#8211;ltitable item 
</para></entry><entry><para>multitable tab
 <!-- comment in multitable -->
 </para></entry></row><row><entry><para>mu&#8211;ltitable item 2 
</para></entry><entry><para>multitable tab 2
-</para><indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
-</entry></row><row><entry><para>lone mu&#8211;ltitable item
+<indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
+</para></entry></row><row><entry><para>lone mu&#8211;ltitable item
 </para></entry></row></tbody></tgroup></informaltable>
 <informaltable><tgroup cols="2"><colspec colwidth="4*"></colspec><colspec 
colwidth="6*"></colspec><tbody><row><entry><para>truc 
</para></entry><entry><para>bidule
 </para></entry></row></tbody></tgroup></informaltable>';
diff --git a/tp/t/results/coverage_braces/contain_plain_text_nestings.pl 
b/tp/t/results/coverage_braces/contain_plain_text_nestings.pl
index 5c408d8899..81416b1fee 100644
--- a/tp/t/results/coverage_braces/contain_plain_text_nestings.pl
+++ b/tp/t/results/coverage_braces/contain_plain_text_nestings.pl
@@ -261,87 +261,87 @@ $result_trees{'contain_plain_text_nestings'} = {
             {
               'text' => '
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
-                {
-                  'text' => 'ii'
-                },
-                {
-                  'text' => ' ',
-                  'type' => 'spaces_at_end'
-                },
+              'args' => [
                 {
-                  'args' => [
+                  'contents' => [
+                    {
+                      'text' => 'ii'
+                    },
                     {
-                      'contents' => [
+                      'text' => ' ',
+                      'type' => 'spaces_at_end'
+                    },
+                    {
+                      'args' => [
                         {
-                          'args' => [
+                          'contents' => [
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'code in sortas'
+                                  'contents' => [
+                                    {
+                                      'text' => 'code in sortas'
+                                    }
+                                  ],
+                                  'type' => 'brace_command_arg'
                                 }
                               ],
-                              'type' => 'brace_command_arg'
+                              'cmdname' => 'code',
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 10,
+                                'macro' => ''
+                              }
+                            },
+                            {
+                              'text' => ' text'
                             }
                           ],
-                          'cmdname' => 'code',
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 10,
-                            'macro' => ''
-                          }
-                        },
-                        {
-                          'text' => ' text'
+                          'type' => 'brace_command_arg'
                         }
                       ],
-                      'type' => 'brace_command_arg'
+                      'cmdname' => 'sortas',
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 10,
+                        'macro' => ''
+                      }
                     }
                   ],
-                  'cmdname' => 'sortas',
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 10,
-                    'macro' => ''
-                  }
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  1
+                ],
+                'sortas' => ' text'
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 10,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              1
-            ],
-            'sortas' => ' text'
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 10,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -540,106 +540,106 @@ $result_trees{'contain_plain_text_nestings'} = {
             {
               'text' => '
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
-                {
-                  'text' => 'ii'
-                },
-                {
-                  'text' => ' ',
-                  'type' => 'spaces_at_end'
-                },
+              'args' => [
                 {
-                  'args' => [
+                  'contents' => [
+                    {
+                      'text' => 'ii'
+                    },
                     {
-                      'contents' => [
+                      'text' => ' ',
+                      'type' => 'spaces_at_end'
+                    },
+                    {
+                      'args' => [
                         {
-                          'args' => [
+                          'contents' => [
                             {
-                              'contents' => [
+                              'args' => [
+                                {
+                                  'contents' => [
+                                    {
+                                      'text' => 'Top'
+                                    }
+                                  ],
+                                  'extra' => {
+                                    'node_content' => [
+                                      {}
+                                    ],
+                                    'normalized' => 'Top'
+                                  },
+                                  'type' => 'brace_command_arg'
+                                },
                                 {
-                                  'text' => 'Top'
+                                  'contents' => [
+                                    {
+                                      'text' => 'cross in sortas'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_before_argument' => {
+                                      'text' => ' '
+                                    }
+                                  },
+                                  'type' => 'brace_command_arg'
                                 }
                               ],
-                              'extra' => {
-                                'node_content' => [
-                                  {}
-                                ],
-                                'normalized' => 'Top'
-                              },
-                              'type' => 'brace_command_arg'
+                              'cmdname' => 'ref',
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 16,
+                                'macro' => ''
+                              }
                             },
                             {
-                              'contents' => [
-                                {
-                                  'text' => 'cross in sortas'
-                                }
-                              ],
-                              'info' => {
-                                'spaces_before_argument' => {
-                                  'text' => ' '
-                                }
-                              },
-                              'type' => 'brace_command_arg'
+                              'text' => ' text'
                             }
                           ],
-                          'cmdname' => 'ref',
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 16,
-                            'macro' => ''
-                          }
-                        },
-                        {
-                          'text' => ' text'
+                          'type' => 'brace_command_arg'
                         }
                       ],
-                      'type' => 'brace_command_arg'
+                      'cmdname' => 'sortas',
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 16,
+                        'macro' => ''
+                      }
                     }
                   ],
-                  'cmdname' => 'sortas',
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 16,
-                    'macro' => ''
-                  }
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ],
+                'sortas' => ' text'
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 16,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ],
-            'sortas' => ' text'
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 16,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -696,12 +696,12 @@ $result_trees{'contain_plain_text_nestings'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'contain_plain_text_nestings'}{'contents'}[3];
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[1]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[1]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[3]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[5]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[5]{'contents'}[5]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[6]{'args'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[6]{'args'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'contain_plain_text_nestings'}{'contents'}[3];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[1]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'contain_plain_text_nestings'}{'contents'}[3];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[1]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[1]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[3]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[3]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[7]{'args'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[7]{'args'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'contain_plain_text_nestings'}{'contents'}[4]{'contents'}[4]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'contain_plain_text_nestings'}{'contents'}[3];
 
 $result_texis{'contain_plain_text_nestings'} = '@node Top
 @top top
@@ -930,8 +930,8 @@ Text ‘code in w’ text.  <‘code in key’ text>
 
 * Menu:
 
-* ii:                                    chap.                  (line 7)
-* ii <1>:                                chap.                  (line 9)
+* ii:                                    chap.                  (line 6)
+* ii <1>:                                chap.                  (line 8)
 
 ';
 
@@ -956,12 +956,12 @@ 
$result_converted{'html_text'}->{'contain_plain_text_nestings'} = '<div class="t
 
 <p>Text <code class="code">code&nbsp;in&nbsp;w</code>&nbsp;text<!-- /@w -->.
 <kbd class="key"><code class="code">code in key</code> text</kbd>
-</p><a class="index-entry-id" id="index-ii"></a>
-
+<a class="index-entry-id" id="index-ii"></a>
+</p>
 <p>Text <a class="ref" href="#Top">cross&nbsp;in&nbsp;w</a>&nbsp;text<!-- /@w 
-->.
 <kbd class="key"><a class="ref" href="#Top">cross in key</a> text</kbd>
-</p><a class="index-entry-id" id="index-ii-1"></a>
-
+<a class="index-entry-id" id="index-ii-1"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-entries-printindex" border="0">
 <tr><td></td><th class="entries-header-printindex">Index Entry</th><th 
class="sections-header-printindex">Section</th></tr>
diff --git a/tp/t/results/float/cindex_in_caption.pl 
b/tp/t/results/float/cindex_in_caption.pl
index e88b0aa7f6..12791ce931 100644
--- a/tp/t/results/float/cindex_in_caption.pl
+++ b/tp/t/results/float/cindex_in_caption.pl
@@ -157,46 +157,46 @@ $result_trees{'cindex_in_caption'} = {
                         {
                           'text' => 'in caption
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'index entry'
+                              'contents' => [
+                                {
+                                  'text' => 'index entry'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              1
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 9,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          1
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 9,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     }
                   ],
                   'type' => 'brace_command_context'
@@ -329,7 +329,7 @@ $result_trees{'cindex_in_caption'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'args'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'cindex_in_caption'}{'contents'}[2];
+$result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'args'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'cindex_in_caption'}{'contents'}[2];
 
$result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'extra'}{'float'}
 = $result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3];
 
$result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3]{'extra'}{'caption'}
 = 
$result_trees{'cindex_in_caption'}{'contents'}[2]{'contents'}[3]{'contents'}[1];
 
@@ -430,7 +430,7 @@ fl 1: in caption
 
 * Menu:
 
-* index entry:                           chap.                  (line 7)
+* index entry:                           chap.                  (line 6)
 
 ';
 
@@ -454,7 +454,7 @@ fl 1: in caption
 [index]
 * Menu:
 
-* index entry:                           chap.                 (line 10)
+* index entry:                           chap.                  (line 9)
 
 
 
@@ -523,8 +523,8 @@ Previous: <a href="#Top" accesskey="p" rel="prev">Top</a> 
&nbsp; [<a href="#chap
 <div class="float" id="label">
 <p>In float.
 </p><div class="caption"><p><strong class="strong">fl 1: </strong>in caption
-</p><a class="index-entry-id" id="index-index-entry"></a>
-</div></div>
+<a class="index-entry-id" id="index-index-entry"></a>
+</p></div></div>
 <div class="printindex cp-printindex">
 <table class="cp-entries-printindex" border="0">
 <tr><td></td><th class="entries-header-printindex">Index Entry</th><th 
class="sections-header-printindex">Section</th></tr>
@@ -561,8 +561,8 @@ $result_converted{'xml'}->{'cindex_in_caption'} = '<node 
name="Top" spaces=" "><
 <float name="label" type="fl" number="1" spaces=" " endspaces=" 
"><floattype>fl</floattype><floatname spaces=" ">label</floatname>
 <para>In float.
 </para><caption><para>in caption
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry</indexterm></cindex>
-</caption>
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry</indexterm></cindex>
+</para></caption>
 </float>
 
 <printindex spaces=" " value="cp" line="cp"></printindex>
diff --git a/tp/t/results/float/complex_float.pl 
b/tp/t/results/float/complex_float.pl
index 72ec9a7c7c..444e7befa0 100644
--- a/tp/t/results/float/complex_float.pl
+++ b/tp/t/results/float/complex_float.pl
@@ -430,46 +430,46 @@ $result_trees{'complex_float'} = {
                 {
                   'text' => 'An index entry
 '
-                }
-              ],
-              'type' => 'paragraph'
-            },
-            {
-              'args' => [
+                },
                 {
-                  'contents' => [
+                  'args' => [
                     {
-                      'text' => 'float example'
+                      'contents' => [
+                        {
+                          'text' => 'float example'
+                        }
+                      ],
+                      'info' => {
+                        'spaces_after_argument' => {
+                          'text' => '
+'
+                        }
+                      },
+                      'type' => 'line_arg'
                     }
                   ],
+                  'cmdname' => 'cindex',
+                  'extra' => {
+                    'element_node' => {},
+                    'index_entry' => [
+                      'cp',
+                      1
+                    ]
+                  },
                   'info' => {
-                    'spaces_after_argument' => {
-                      'text' => '
-'
+                    'spaces_before_argument' => {
+                      'text' => ' '
                     }
                   },
-                  'type' => 'line_arg'
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 30,
+                    'macro' => ''
+                  },
+                  'type' => 'index_entry_command'
                 }
               ],
-              'cmdname' => 'cindex',
-              'extra' => {
-                'element_node' => {},
-                'index_entry' => [
-                  'cp',
-                  1
-                ]
-              },
-              'info' => {
-                'spaces_before_argument' => {
-                  'text' => ' '
-                }
-              },
-              'source_info' => {
-                'file_name' => '',
-                'line_nr' => 30,
-                'macro' => ''
-              },
-              'type' => 'index_entry_command'
+              'type' => 'paragraph'
             },
             {
               'text' => '
@@ -1516,46 +1516,46 @@ $result_trees{'complex_float'} = {
                         {
                           'text' => 'An index entry
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'float example in caption'
+                              'contents' => [
+                                {
+                                  'text' => 'float example in caption'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              2
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 71,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          2
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 71,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     },
                     {
                       'text' => '
@@ -2867,46 +2867,46 @@ $result_trees{'complex_float'} = {
                         {
                           'text' => 'An index entry 2
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'float example in caption 2'
+                              'contents' => [
+                                {
+                                  'text' => 'float example in caption 2'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              3
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 116,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          3
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 116,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     },
                     {
                       'text' => '
@@ -3490,23 +3490,23 @@ $result_trees{'complex_float'} = {
   'type' => 'document_root'
 };
 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[1];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[8]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[8]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[11]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[11]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[13]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[13]{'contents'}[1]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[7]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[12]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[1];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[15]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[15]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[17]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'args'}[0]{'contents'}[17]{'contents'}[1]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17]{'extra'}{'float'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[20]{'extra'}{'float'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'extra'}{'caption'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[17];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[1];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[10]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[10]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[12]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[12]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[11]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[1];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[14]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[14]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[16]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'args'}[0]{'contents'}[16]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16]{'extra'}{'float'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[19]{'extra'}{'float'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'extra'}{'caption'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[16];
 
$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'extra'}{'float_section'}
 = $result_trees{'complex_float'}{'contents'}[2];
-$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'extra'}{'shortcaption'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[20];
+$result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'extra'}{'shortcaption'}
 = $result_trees{'complex_float'}{'contents'}[2]{'contents'}[7]{'contents'}[19];
 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[4]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[4]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[9]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[3];
-$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[12]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[12]{'args'}[0]{'contents'}[0];
-$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[17]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[17]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[8]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'complex_float'}{'contents'}[3];
+$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[11]{'extra'}{'command_as_argument'}
 = 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[11]{'args'}[0]{'contents'}[0];
+$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[16]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'args'}[0]{'contents'}[16]{'contents'}[1]{'args'}[0]{'contents'}[0];
 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'extra'}{'float'}
 = $result_trees{'complex_float'}{'contents'}[4]{'contents'}[1];
 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'extra'}{'caption'}
 = $result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'contents'}[3];
 
$result_trees{'complex_float'}{'contents'}[4]{'contents'}[1]{'extra'}{'float_section'}
 = $result_trees{'complex_float'}{'contents'}[4];
@@ -4048,8 +4048,8 @@ A footnote 2.
 </p>
 
 <p>An index entry
-</p><a class="index-entry-id" id="index-float-example"></a>
-
+<a class="index-entry-id" id="index-float-example"></a>
+</p>
 <p>A table.
 </p><dl class="table">
 <dt><em class="emph">truc</em></dt>
@@ -4093,8 +4093,8 @@ An example.
 </tbody>
 </table>
 <p>An index entry
-</p><a class="index-entry-id" id="index-float-example-in-caption"></a>
-
+<a class="index-entry-id" id="index-float-example-in-caption"></a>
+</p>
 <p>An itemize.
 </p><ul class="itemize mark-minus">
 <li>truc 
@@ -4144,8 +4144,8 @@ An example 2.
 </tbody>
 </table>
 <p>An index entry 2
-</p><a class="index-entry-id" id="index-float-example-in-caption-2"></a>
-
+<a class="index-entry-id" id="index-float-example-in-caption-2"></a>
+</p>
 <p>An itemize 2.
 </p><ul class="itemize mark-minus">
 <li>truc 2
@@ -4202,8 +4202,8 @@ $result_converted{'xml'}->{'complex_float'} = '<node 
name="Top" spaces=" "><node
 <!-- c makeinfo -docbook segfaults -->
 
 <para>An index entry
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">float 
example</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">float 
example</indexterm></cindex>
+</para>
 <para>A table.
 </para><table commandarg="emph" spaces=" " endspaces=" ">
 <tableentry><tableterm><item spaces=" "><itemformat command="emph">truc 
</itemformat></item>
@@ -4243,8 +4243,8 @@ An example.
 </para></entry></row><row><entry command="item"> <para>truc 
</para></entry><entry command="tab"> <para>bidule
 </para></entry></row></tbody></multitable>
 <para>An index entry
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="2">float 
example in caption</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="2">float example 
in caption</indexterm></cindex>
+</para>
 <para>An itemize.
 </para><itemize commandarg="minus" spaces=" " endspaces=" 
"><itemprepend><formattingcommand command="minus"/></itemprepend>
 <listitem><prepend>&minus;</prepend> <para>truc 
@@ -4289,8 +4289,8 @@ An example 2.
 </para></entry></row><row><entry command="item"> <para>truc 2 
</para></entry><entry command="tab"> <para>bidule
 </para></entry></row></tbody></multitable>
 <para>An index entry 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="3">float 
example in caption 2</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="3">float example 
in caption 2</indexterm></cindex>
+</para>
 <para>An itemize 2.
 </para><itemize commandarg="minus" spaces=" " endspaces=" 
"><itemprepend><formattingcommand command="minus"/></itemprepend>
 <listitem><prepend>&minus;</prepend> <para>truc 2
diff --git a/tp/t/results/formats_encodings/sample_utf8.pl 
b/tp/t/results/formats_encodings/sample_utf8.pl
index 92d7edd9af..f8d9696206 100644
--- a/tp/t/results/formats_encodings/sample_utf8.pl
+++ b/tp/t/results/formats_encodings/sample_utf8.pl
@@ -861,120 +861,120 @@ $result_trees{'sample_utf8'} = {
             {
               'text' => "This is the first chapter. 
\x{8fd9}\x{662f}\x{7b2c}\x{4e00}\x{7ae0}\x{3002}
 "
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => "\x{53e6}\x{4e00}\x{4e2a}\x{ff0c}index entry"
+                  'contents' => [
+                    {
+                      'text' => "\x{53e6}\x{4e00}\x{4e2a}\x{ff0c}index entry"
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'sample_utf8.texi',
-            'line_nr' => 47,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'sample_utf8.texi',
+                'line_nr' => 47,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => "\x{104}\x{118} ae \x{105}\x{119}"
+                  'contents' => [
+                    {
+                      'text' => "\x{104}\x{118} ae \x{105}\x{119}"
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'sample_utf8.texi',
-            'line_nr' => 48,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'sample_utf8.texi',
+                'line_nr' => 48,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => "\x{e9} \x{c2}"
+                  'contents' => [
+                    {
+                      'text' => "\x{e9} \x{c2}"
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'sample_utf8.texi',
+                'line_nr' => 49,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'sample_utf8.texi',
-            'line_nr' => 49,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1343,9 +1343,9 @@ 
$result_trees{'sample_utf8'}{'contents'}[2]{'contents'}[3]{'contents'}[0]{'conte
 
$result_trees{'sample_utf8'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'sample_utf8'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'sample_utf8'}{'contents'}[2]{'contents'}[3]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'sample_utf8'}{'contents'}[2]{'contents'}[3]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
-$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
-$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
-$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
+$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[3]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
+$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[3]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
+$result_trees{'sample_utf8'}{'contents'}[4]{'contents'}[3]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'sample_utf8'}{'contents'}[3];
 
 $result_texis{'sample_utf8'} = '\\input texinfo   @c -*-texinfo-*-
 @c %**start of header
diff --git 
a/tp/t/results/formats_encodings/sample_utf8/res_html/DiYiZhang_0028First-Chapter_0029.html
 
b/tp/t/results/formats_encodings/sample_utf8/res_html/DiYiZhang_0028First-Chapter_0029.html
index 67aaae655e..1ba51f4da2 100644
--- 
a/tp/t/results/formats_encodings/sample_utf8/res_html/DiYiZhang_0028First-Chapter_0029.html
+++ 
b/tp/t/results/formats_encodings/sample_utf8/res_html/DiYiZhang_0028First-Chapter_0029.html
@@ -43,10 +43,10 @@ Next: <a href="Second-Chapter-AE-AE-ae-ae.html" 
accesskey="n" rel="next">Chapter
 <a class="index-entry-id" id="index-chapter_002c-first"></a>
 
 <p>This is the first chapter. 这是第一章。
-</p><a class="index-entry-id" id="index-LingYiGe_002cindex-entry"></a>
+<a class="index-entry-id" id="index-LingYiGe_002cindex-entry"></a>
 <a class="index-entry-id" id="index-AE-ae-ae"></a>
 <a class="index-entry-id" id="index-e-A"></a>
-
+</p>
 <p>Here is a numbered list.
 </p>
 <ol class="enumerate">
diff --git 
a/tp/t/results/formats_encodings/sample_utf8/res_info/sample_utf8.info 
b/tp/t/results/formats_encodings/sample_utf8/res_info/sample_utf8.info
index 16d44d597d..3b49993aad 100644
Binary files 
a/tp/t/results/formats_encodings/sample_utf8/res_info/sample_utf8.info and 
b/tp/t/results/formats_encodings/sample_utf8/res_info/sample_utf8.info differ
diff --git a/tp/t/results/indices/index_entries_locations.pl 
b/tp/t/results/indices/index_entries_locations.pl
index 58ee42b61e..9e8600dbcf 100644
--- a/tp/t/results/indices/index_entries_locations.pl
+++ b/tp/t/results/indices/index_entries_locations.pl
@@ -101,92 +101,87 @@ $result_trees{'index_entries_locations'} = {
             {
               'text' => 'Paragraph
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in paragraph'
+                  'contents' => [
+                    {
+                      'text' => 'entry in paragraph'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 8,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'contents' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 8,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
               'text' => 'end paragraph.
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry at end of paragraph.'
+                  'contents' => [
+                    {
+                      'text' => 'entry at end of paragraph.'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 10,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 10,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -367,10 +362,10 @@ $result_trees{'index_entries_locations'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
-$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
+$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
+$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[3]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
+$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
 
$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[10]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
-$result_trees{'index_entries_locations'}{'contents'}[2]{'contents'}[13]{'extra'}{'element_node'}
 = $result_trees{'index_entries_locations'}{'contents'}[2];
 
 $result_texis{'index_entries_locations'} = '
 @node Top
@@ -466,8 +461,7 @@ File: ,  Node: chap,  Prev: Top
 
 Initial paragraph.
 
-   Paragraph
-   end paragraph.
+   Paragraph end paragraph.
 
    New paragraph.
 
@@ -478,10 +472,10 @@ Initial paragraph.
 [index]
 * Menu:
 
-* entry at end of paragraph.:            chap.                 (line  7)
-* Entry before paragraph:                chap.                 (line 10)
-* entry in paragraph:                    chap.                 (line  6)
-* lone entry:                            chap.                 (line 12)
+* entry at end of paragraph.:            chap.                 (line  5)
+* Entry before paragraph:                chap.                 (line  9)
+* entry in paragraph:                    chap.                 (line  5)
+* lone entry:                            chap.                 (line 11)
 
 
 
@@ -500,8 +494,7 @@ End:
 
 $result_converted{'plaintext'}->{'index_entries_locations'} = 'Initial 
paragraph.
 
-   Paragraph
-   end paragraph.
+   Paragraph end paragraph.
 
    New paragraph.
 
@@ -511,10 +504,10 @@ 
$result_converted{'plaintext'}->{'index_entries_locations'} = 'Initial paragraph
 
 * Menu:
 
-* entry at end of paragraph.:            chap.                  (line 4)
-* Entry before paragraph:                chap.                  (line 7)
-* entry in paragraph:                    chap.                  (line 3)
-* lone entry:                            chap.                  (line 9)
+* entry at end of paragraph.:            chap.                  (line 2)
+* Entry before paragraph:                chap.                  (line 6)
+* entry in paragraph:                    chap.                  (line 2)
+* lone entry:                            chap.                  (line 8)
 
 ';
 
@@ -534,10 +527,10 @@ 
$result_converted{'html_text'}->{'index_entries_locations'} = '<a class="node-id
 <p>Initial paragraph.
 </p>
 <p>Paragraph
-</p><a class="index-entry-id" id="index-entry-in-paragraph"></a>
-<p>end paragraph.
-</p><a class="index-entry-id" id="index-entry-at-end-of-paragraph_002e"></a>
-
+<a class="index-entry-id" id="index-entry-in-paragraph"></a>
+end paragraph.
+<a class="index-entry-id" id="index-entry-at-end-of-paragraph_002e"></a>
+</p>
 <p>New paragraph.
 </p>
 <a class="index-entry-id" id="index-Entry-before-paragraph"></a>
@@ -581,10 +574,10 @@ $result_converted{'xml'}->{'index_entries_locations'} = 
'<preamblebeforebeginnin
 <para>Initial paragraph.
 </para>
 <para>Paragraph
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">entry in 
paragraph</indexterm></cindex>
-<para>end paragraph.
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="2">entry at 
end of paragraph.</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">entry in 
paragraph</indexterm></cindex>
+end paragraph.
+<cindex index="cp" spaces=" "><indexterm index="cp" number="2">entry at end of 
paragraph.</indexterm></cindex>
+</para>
 <para>New paragraph.
 </para>
 <cindex index="cp" spaces=" "><indexterm index="cp" number="3">Entry before 
paragraph</indexterm></cindex>
diff --git a/tp/t/results/indices/index_entry_in_footnote.pl 
b/tp/t/results/indices/index_entry_in_footnote.pl
index 7600ddf64f..f8ebd49a01 100644
Binary files a/tp/t/results/indices/index_entry_in_footnote.pl and 
b/tp/t/results/indices/index_entry_in_footnote.pl differ
diff --git a/tp/t/results/indices/index_entry_in_footnote_different_node_end.pl 
b/tp/t/results/indices/index_entry_in_footnote_different_node_end.pl
index 61b9291a98..29146821b8 100644
--- a/tp/t/results/indices/index_entry_in_footnote_different_node_end.pl
+++ b/tp/t/results/indices/index_entry_in_footnote_different_node_end.pl
@@ -243,46 +243,46 @@ 
$result_trees{'index_entry_in_footnote_different_node_end'} = {
                         {
                           'text' => 'in footnote
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'index entry in footnote'
+                              'contents' => [
+                                {
+                                  'text' => 'index entry in footnote'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              1
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 11,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          1
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 11,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     },
                     {
                       'text' => '
@@ -471,8 +471,8 @@ $result_trees{'index_entry_in_footnote_different_node_end'} 
= {
 };
 
$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[0];
-$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2];
-$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2];
+$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2];
+$result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_different_node_end'}{'contents'}[2];
 
 $result_texis{'index_entry_in_footnote_different_node_end'} = '@node Top
 
@@ -633,7 +633,7 @@ File: ,  Node: First,  Prev: chap,  Up: Top
 * Menu:
 
 * counting entry:                        chap.                 (line 12)
-* index entry in footnote:               chap.                 (line  8)
+* index entry in footnote:               chap.                 (line  7)
 
 
 
@@ -665,7 +665,7 @@ 
$result_converted{'plaintext'}->{'index_entry_in_footnote_different_node_end'} =
 * Menu:
 
 * counting entry:                        chap.                  (line 9)
-* index entry in footnote:               chap.                  (line 5)
+* index entry in footnote:               chap.                  (line 4)
 
 ';
 
@@ -721,8 +721,8 @@ 
$result_converted{'html_text'}->{'index_entry_in_footnote_different_node_end'} =
 
 <h5 class="footnote-body-heading"><a id="FOOT1" href="#DOCF1">(1)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
@@ -742,8 +742,8 @@ 
$result_converted{'xml'}->{'index_entry_in_footnote_different_node_end'} = '<nod
 <node name="chap" spaces=" "><nodename>chap</nodename><nodenext 
automatic="on">First</nodenext><nodeprev automatic="on">Top</nodeprev><nodeup 
automatic="on">Top</nodeup></node>
 
 <para>chap node<footnote><para>in footnote
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry in footnote</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index entry in 
footnote</indexterm></cindex>
+</para>
 <para>Blah
 </para>
 <para>Blih
diff --git a/tp/t/results/indices/index_entry_in_footnote_sections.pl 
b/tp/t/results/indices/index_entry_in_footnote_sections.pl
index cad238e5f6..fb9b11cb35 100644
--- a/tp/t/results/indices/index_entry_in_footnote_sections.pl
+++ b/tp/t/results/indices/index_entry_in_footnote_sections.pl
@@ -100,46 +100,46 @@ $result_trees{'index_entry_in_footnote_sections'} = {
                         {
                           'text' => 'Another para in footnote.
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'index entry in footnote'
+                              'contents' => [
+                                {
+                                  'text' => 'index entry in footnote'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              1
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 7,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          1
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 7,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     }
                   ],
                   'type' => 'brace_command_context'
@@ -284,7 +284,7 @@ $result_trees{'index_entry_in_footnote_sections'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'index_entry_in_footnote_sections'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_sections'}{'contents'}[1];
+$result_trees{'index_entry_in_footnote_sections'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_sections'}{'contents'}[1];
 
 $result_texis{'index_entry_in_footnote_sections'} = '@node Top
 @top index_entry_in_footnote
@@ -525,7 +525,8 @@ 
$result_converted{'html_text'}->{'index_entry_in_footnote_sections'} = '<div cla
 <p>in footnote
 </p>
 <p>Another para in footnote.
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 </div>
 ';
 
@@ -536,8 +537,8 @@ 
$result_converted{'xml'}->{'index_entry_in_footnote_sections'} = '<node name="To
 <para>Top node<footnote><para>in footnote
 </para>
 <para>Another para in footnote.
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry in footnote</indexterm></cindex>
-</footnote>
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index entry in 
footnote</indexterm></cindex>
+</para></footnote>
 </para>
 </top>
 <node name="Index" spaces=" "><nodename>Index</nodename><nodeprev 
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
diff --git a/tp/t/results/indices/index_entry_in_footnote_sections_separate.pl 
b/tp/t/results/indices/index_entry_in_footnote_sections_separate.pl
index a3e0795679..230a5fb29c 100644
--- a/tp/t/results/indices/index_entry_in_footnote_sections_separate.pl
+++ b/tp/t/results/indices/index_entry_in_footnote_sections_separate.pl
@@ -100,46 +100,46 @@ 
$result_trees{'index_entry_in_footnote_sections_separate'} = {
                         {
                           'text' => 'Another para in footnote.
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'index entry in footnote'
+                              'contents' => [
+                                {
+                                  'text' => 'index entry in footnote'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              1
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 7,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          1
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 7,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     }
                   ],
                   'type' => 'brace_command_context'
@@ -284,7 +284,7 @@ $result_trees{'index_entry_in_footnote_sections_separate'} 
= {
   ],
   'type' => 'document_root'
 };
-$result_trees{'index_entry_in_footnote_sections_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_sections_separate'}{'contents'}[1];
+$result_trees{'index_entry_in_footnote_sections_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_sections_separate'}{'contents'}[1];
 
 $result_texis{'index_entry_in_footnote_sections_separate'} = '@node Top
 @top index_entry_in_footnote
@@ -529,7 +529,8 @@ 
$result_converted{'html_text'}->{'index_entry_in_footnote_sections_separate'} =
 <p>in footnote
 </p>
 <p>Another para in footnote.
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 </div>';
 
 
@@ -539,8 +540,8 @@ 
$result_converted{'xml'}->{'index_entry_in_footnote_sections_separate'} = '<node
 <para>Top node<footnote><para>in footnote
 </para>
 <para>Another para in footnote.
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry in footnote</indexterm></cindex>
-</footnote>
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index entry in 
footnote</indexterm></cindex>
+</para></footnote>
 </para>
 </top>
 <node name="Index" spaces=" "><nodename>Index</nodename><nodeprev 
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
diff --git a/tp/t/results/indices/index_entry_in_footnote_separate.pl 
b/tp/t/results/indices/index_entry_in_footnote_separate.pl
index 4cc44ab0c8..91e1596565 100644
--- a/tp/t/results/indices/index_entry_in_footnote_separate.pl
+++ b/tp/t/results/indices/index_entry_in_footnote_separate.pl
@@ -278,46 +278,46 @@ $result_trees{'index_entry_in_footnote_separate'} = {
                         {
                           'text' => 'in footnote
 '
-                        }
-                      ],
-                      'type' => 'paragraph'
-                    },
-                    {
-                      'args' => [
+                        },
                         {
-                          'contents' => [
+                          'args' => [
                             {
-                              'text' => 'index entry in footnote'
+                              'contents' => [
+                                {
+                                  'text' => 'index entry in footnote'
+                                }
+                              ],
+                              'info' => {
+                                'spaces_after_argument' => {
+                                  'text' => '
+'
+                                }
+                              },
+                              'type' => 'line_arg'
                             }
                           ],
+                          'cmdname' => 'cindex',
+                          'extra' => {
+                            'element_node' => {},
+                            'index_entry' => [
+                              'cp',
+                              1
+                            ]
+                          },
                           'info' => {
-                            'spaces_after_argument' => {
-                              'text' => '
-'
+                            'spaces_before_argument' => {
+                              'text' => ' '
                             }
                           },
-                          'type' => 'line_arg'
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 12,
+                            'macro' => ''
+                          },
+                          'type' => 'index_entry_command'
                         }
                       ],
-                      'cmdname' => 'cindex',
-                      'extra' => {
-                        'element_node' => {},
-                        'index_entry' => [
-                          'cp',
-                          1
-                        ]
-                      },
-                      'info' => {
-                        'spaces_before_argument' => {
-                          'text' => ' '
-                        }
-                      },
-                      'source_info' => {
-                        'file_name' => '',
-                        'line_nr' => 12,
-                        'macro' => ''
-                      },
-                      'type' => 'index_entry_command'
+                      'type' => 'paragraph'
                     },
                     {
                       'text' => '
@@ -506,8 +506,8 @@ $result_trees{'index_entry_in_footnote_separate'} = {
 };
 
$result_trees{'index_entry_in_footnote_separate'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_entry_in_footnote_separate'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_entry_in_footnote_separate'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_entry_in_footnote_separate'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[0];
-$result_trees{'index_entry_in_footnote_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_separate'}{'contents'}[2];
-$result_trees{'index_entry_in_footnote_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_separate'}{'contents'}[2];
+$result_trees{'index_entry_in_footnote_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_separate'}{'contents'}[2];
+$result_trees{'index_entry_in_footnote_separate'}{'contents'}[2]{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'index_entry_in_footnote_separate'}{'contents'}[2];
 
 $result_texis{'index_entry_in_footnote_separate'} = '@footnotestyle separate
 @node Top
@@ -670,7 +670,7 @@ File: ,  Node: First,  Prev: chap,  Up: Top
 * Menu:
 
 * counting entry:                        chap-Footnotes.        (line 8)
-* index entry in footnote:               chap-Footnotes.        (line 4)
+* index entry in footnote:               chap-Footnotes.        (line 3)
 
 
 
@@ -701,7 +701,7 @@ 
$result_converted{'plaintext'}->{'index_entry_in_footnote_separate'} = 'chap nod
 * Menu:
 
 * counting entry:                        chap-Footnotes.        (line 7)
-* index entry in footnote:               chap-Footnotes.        (line 3)
+* index entry in footnote:               chap-Footnotes.        (line 2)
 
 ';
 
@@ -761,8 +761,8 @@ 
$result_converted{'html_text'}->{'index_entry_in_footnote_separate'} = '<a class
 
 <h5 class="footnote-body-heading"><a id="FOOT1" href="#DOCF1">(1)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
@@ -782,8 +782,8 @@ 
$result_converted{'xml'}->{'index_entry_in_footnote_separate'} = '<footnotestyle
 <node name="chap" spaces=" "><nodename>chap</nodename><nodenext 
automatic="on">First</nodenext><nodeprev automatic="on">Top</nodeprev><nodeup 
automatic="on">Top</nodeup></node>
 
 <para>chap node<footnote><para>in footnote
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">index 
entry in footnote</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">index entry in 
footnote</indexterm></cindex>
+</para>
 <para>Blah
 </para>
 <para>Blih
diff --git a/tp/t/results/indices/index_no_node.pl 
b/tp/t/results/indices/index_no_node.pl
index 0d42361fdf..d9c569ea74 100644
--- a/tp/t/results/indices/index_no_node.pl
+++ b/tp/t/results/indices/index_no_node.pl
@@ -257,45 +257,45 @@ $result_trees{'index_no_node'} = {
             {
               'text' => 'in unnumbered
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'unnumbered after text'
+                  'contents' => [
+                    {
+                      'text' => 'unnumbered after text'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node.texi',
+                'line_nr' => 15,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node.texi',
-            'line_nr' => 15,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -803,45 +803,45 @@ $result_trees{'index_no_node'} = {
             {
               'text' => 'second node
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'second'
+                  'contents' => [
+                    {
+                      'text' => 'second'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  12
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node.texi',
+                'line_nr' => 39,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              12
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node.texi',
-            'line_nr' => 39,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -993,45 +993,45 @@ $result_trees{'index_no_node'} = {
             {
               'text' => 'Text of chapter
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'Chapter2'
+                  'contents' => [
+                    {
+                      'text' => 'Chapter2'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  14
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node.texi',
+                'line_nr' => 47,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              14
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node.texi',
-            'line_nr' => 47,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
diff --git a/tp/t/results/indices/index_no_node/res_html/Chapter.html 
b/tp/t/results/indices/index_no_node/res_html/Chapter.html
index 267e499611..7fdc26165c 100644
--- a/tp/t/results/indices/index_no_node/res_html/Chapter.html
+++ b/tp/t/results/indices/index_no_node/res_html/Chapter.html
@@ -84,8 +84,8 @@ Next: <a href="Chapter-2.html" accesskey="n" 
rel="next">Chapter 2</a>, Prev: <a
 </td></tr></table>
 </div>
 <p>Text of chapter
-</p><a class="index-entry-id" id="index-Chapter2"></a>
-
+<a class="index-entry-id" id="index-Chapter2"></a>
+</p>
 </div>
 <hr>
 <div class="nav-panel">
diff --git a/tp/t/results/indices/index_no_node/res_html/index.html 
b/tp/t/results/indices/index_no_node/res_html/index.html
index a31cd3ba48..991a555f23 100644
--- a/tp/t/results/indices/index_no_node/res_html/index.html
+++ b/tp/t/results/indices/index_no_node/res_html/index.html
@@ -153,8 +153,8 @@ Next: <a href="Chapter.html" accesskey="n" 
rel="next">Chapter</a>, Prev: <a href
 </div>
 <a class="index-entry-id" id="index-second"></a>
 <p>second node
-</p><a class="index-entry-id" id="index-second-1"></a>
-
+<a class="index-entry-id" id="index-second-1"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#second_cp_letter-C"><b>C</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/index_no_node/res_html/unnumbered.html 
b/tp/t/results/indices/index_no_node/res_html/unnumbered.html
index c0000d0be5..8ce4e96c4d 100644
--- a/tp/t/results/indices/index_no_node/res_html/unnumbered.html
+++ b/tp/t/results/indices/index_no_node/res_html/unnumbered.html
@@ -89,8 +89,8 @@ Next: <a href="index.html#top-section" accesskey="n" 
rel="next">top section</a>
 
 <a class="index-entry-id" id="index-unnumbered"></a>
 <p>in unnumbered
-</p><a class="index-entry-id" id="index-unnumbered-after-text"></a>
-
+<a class="index-entry-id" id="index-unnumbered-after-text"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#unnumbered_cp_letter-C"><b>C</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/index_no_node_no_top.pl 
b/tp/t/results/indices/index_no_node_no_top.pl
index e5dfb837b0..e2b499476d 100644
--- a/tp/t/results/indices/index_no_node_no_top.pl
+++ b/tp/t/results/indices/index_no_node_no_top.pl
@@ -214,45 +214,45 @@ $result_trees{'index_no_node_no_top'} = {
             {
               'text' => 'in unnumbered
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'unnumbered after text'
+                  'contents' => [
+                    {
+                      'text' => 'unnumbered after text'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 13,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 13,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -760,45 +760,45 @@ $result_trees{'index_no_node_no_top'} = {
             {
               'text' => 'second node
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'second'
+                  'contents' => [
+                    {
+                      'text' => 'second'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  12
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 37,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              12
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 37,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -950,45 +950,45 @@ $result_trees{'index_no_node_no_top'} = {
             {
               'text' => 'Text of chapter
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'Chapter2'
+                  'contents' => [
+                    {
+                      'text' => 'Chapter2'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  14
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 45,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              14
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 45,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1882,8 +1882,8 @@ $result_converted{'html_text'}->{'index_no_node_no_top'} 
= '<a class="index-entr
 
 <a class="index-entry-id" id="index-unnumbered"></a>
 <p>in unnumbered
-</p><a class="index-entry-id" id="index-unnumbered-after-text"></a>
-
+<a class="index-entry-id" id="index-unnumbered-after-text"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#unnumbered_cp_letter-C"><b>C</b></a>
  &nbsp; 
@@ -2047,8 +2047,8 @@ $result_converted{'html_text'}->{'index_no_node_no_top'} 
= '<a class="index-entr
 </div>
 <a class="index-entry-id" id="index-second"></a>
 <p>second node
-</p><a class="index-entry-id" id="index-second-1"></a>
-
+<a class="index-entry-id" id="index-second-1"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#second_cp_letter-C"><b>C</b></a>
  &nbsp; 
@@ -2148,8 +2148,8 @@ $result_converted{'html_text'}->{'index_no_node_no_top'} 
= '<a class="index-entr
 </td></tr></table>
 </div>
 <p>Text of chapter
-</p><a class="index-entry-id" id="index-Chapter2"></a>
-
+<a class="index-entry-id" id="index-Chapter2"></a>
+</p>
 </div>
 <div class="chapter-level-extent" id="Chapter-2">
 <h2 class="chapter"><span>2 Chapter 2<a class="copiable-link" 
href="#Chapter-2"> &para;</a></span></h2>
@@ -2172,8 +2172,8 @@ $result_converted{'xml'}->{'index_no_node_no_top'} = 
'<preamblebeforebeginning>\
 
 <cindex index="cp" spaces=" "><indexterm index="cp" 
number="2">unnumbered</indexterm></cindex>
 <para>in unnumbered
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="3">unnumbered after text</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="3">unnumbered 
after text</indexterm></cindex>
+</para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
 
 </unnumbered>
@@ -2197,8 +2197,8 @@ $result_converted{'xml'}->{'index_no_node_no_top'} = 
'<preamblebeforebeginning>\
 <printindex spaces=" " value="cp" line="cp"></printindex>
 <cindex index="cp" spaces=" "><indexterm index="cp" 
number="11">second</indexterm></cindex>
 <para>second node
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="12">second</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="12">second</indexterm></cindex>
+</para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
 </section>
 </unnumbered>
@@ -2207,8 +2207,8 @@ $result_converted{'xml'}->{'index_no_node_no_top'} = 
'<preamblebeforebeginning>\
 
 <printindex spaces=" " value="cp" line="cp"></printindex>
 <para>Text of chapter
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="14">Chapter2</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="14">Chapter2</indexterm></cindex>
+</para>
 </chapter>
 <chapter spaces=" "><sectiontitle>Chapter 2</sectiontitle>
 
diff --git a/tp/t/results/indices/index_no_node_no_top_no_node.pl 
b/tp/t/results/indices/index_no_node_no_top_no_node.pl
index 55039db751..a679b4d742 100644
--- a/tp/t/results/indices/index_no_node_no_top_no_node.pl
+++ b/tp/t/results/indices/index_no_node_no_top_no_node.pl
@@ -214,45 +214,45 @@ $result_trees{'index_no_node_no_top_no_node'} = {
             {
               'text' => 'in unnumbered
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'unnumbered after text'
+                  'contents' => [
+                    {
+                      'text' => 'unnumbered after text'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 13,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 13,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -760,45 +760,45 @@ $result_trees{'index_no_node_no_top_no_node'} = {
             {
               'text' => 'second node
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'second'
+                  'contents' => [
+                    {
+                      'text' => 'second'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  12
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 37,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              12
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 37,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -950,45 +950,45 @@ $result_trees{'index_no_node_no_top_no_node'} = {
             {
               'text' => 'Text of chapter
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'Chapter2'
+                  'contents' => [
+                    {
+                      'text' => 'Chapter2'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  14
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_no_node_no_top.texi',
+                'line_nr' => 45,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              14
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_no_node_no_top.texi',
-            'line_nr' => 45,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1886,8 +1886,8 @@ 
$result_converted{'html_text'}->{'index_no_node_no_top_no_node'} = '<a class="in
 
 <a class="index-entry-id" id="index-unnumbered"></a>
 <p>in unnumbered
-</p><a class="index-entry-id" id="index-unnumbered-after-text"></a>
-
+<a class="index-entry-id" id="index-unnumbered-after-text"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#unnumbered_cp_letter-C"><b>C</b></a>
  &nbsp; 
@@ -2061,8 +2061,8 @@ 
$result_converted{'html_text'}->{'index_no_node_no_top_no_node'} = '<a class="in
 </div>
 <a class="index-entry-id" id="index-second"></a>
 <p>second node
-</p><a class="index-entry-id" id="index-second-1"></a>
-
+<a class="index-entry-id" id="index-second-1"></a>
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#second_cp_letter-C"><b>C</b></a>
  &nbsp; 
@@ -2167,8 +2167,8 @@ 
$result_converted{'html_text'}->{'index_no_node_no_top_no_node'} = '<a class="in
 </td></tr></table>
 </div>
 <p>Text of chapter
-</p><a class="index-entry-id" id="index-Chapter2"></a>
-
+<a class="index-entry-id" id="index-Chapter2"></a>
+</p>
 <hr>
 </div>
 <div class="chapter-level-extent" id="Chapter-2">
@@ -2196,8 +2196,8 @@ 
$result_converted{'xml'}->{'index_no_node_no_top_no_node'} = '<preamblebeforebeg
 
 <cindex index="cp" spaces=" "><indexterm index="cp" 
number="2">unnumbered</indexterm></cindex>
 <para>in unnumbered
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="3">unnumbered after text</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="3">unnumbered 
after text</indexterm></cindex>
+</para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
 
 </unnumbered>
@@ -2221,8 +2221,8 @@ 
$result_converted{'xml'}->{'index_no_node_no_top_no_node'} = '<preamblebeforebeg
 <printindex spaces=" " value="cp" line="cp"></printindex>
 <cindex index="cp" spaces=" "><indexterm index="cp" 
number="11">second</indexterm></cindex>
 <para>second node
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="12">second</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="12">second</indexterm></cindex>
+</para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
 </section>
 </unnumbered>
@@ -2231,8 +2231,8 @@ 
$result_converted{'xml'}->{'index_no_node_no_top_no_node'} = '<preamblebeforebeg
 
 <printindex spaces=" " value="cp" line="cp"></printindex>
 <para>Text of chapter
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="14">Chapter2</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="14">Chapter2</indexterm></cindex>
+</para>
 </chapter>
 <chapter spaces=" "><sectiontitle>Chapter 2</sectiontitle>
 
diff --git a/tp/t/results/indices/index_nodes.pl 
b/tp/t/results/indices/index_nodes.pl
index de47c4596e..295de9fb8f 100644
--- a/tp/t/results/indices/index_nodes.pl
+++ b/tp/t/results/indices/index_nodes.pl
@@ -401,157 +401,157 @@ $result_trees{'index_nodes'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 20,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 20,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 21,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 21,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 22,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 22,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 23,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 23,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1452,11 +1452,11 @@ 
$result_trees{'index_nodes'}{'contents'}[1]{'contents'}[0]{'extra'}{'element_nod
 
$result_trees{'index_nodes'}{'contents'}[1]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes'}{'contents'}[1]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes'}{'contents'}[2]{'args'}[2]{'extra'}{'node_content'}[0]
 = $result_trees{'index_nodes'}{'contents'}[2]{'args'}[2]{'contents'}[0];
 
$result_trees{'index_nodes'}{'contents'}[2]{'args'}[3]{'extra'}{'node_content'}[0]
 = $result_trees{'index_nodes'}{'contents'}[2]{'args'}[3]{'contents'}[0];
-$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
-$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
-$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
-$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
-$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[8]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[8]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
+$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
+$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
+$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_nodes'}{'contents'}[2];
+$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes'}{'contents'}[2]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes'}{'contents'}[3]{'args'}[3]{'extra'}{'node_content'}[0]
 = $result_trees{'index_nodes'}{'contents'}[3]{'args'}[3]{'contents'}[0];
 
$result_trees{'index_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git a/tp/t/results/indices/index_nodes/res_html/chap-first.html 
b/tp/t/results/indices/index_nodes/res_html/chap-first.html
index c4e15e172e..86de5b42a3 100644
--- a/tp/t/results/indices/index_nodes/res_html/chap-first.html
+++ b/tp/t/results/indices/index_nodes/res_html/chap-first.html
@@ -38,11 +38,11 @@ Previous: <a href="index.html" accesskey="p" 
rel="prev">Top</a>, Up: <a href="in
 <hr>
 <h4 class="node"><span>chap first<a class="copiable-link" href="#chap-first"> 
&para;</a></span></h4>
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-entry-in-node"></a>
+<a class="index-entry-id" id="index-entry-in-node"></a>
 <a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node-1"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chap-first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/index_nodes/res_info/index_nodes.info 
b/tp/t/results/indices/index_nodes/res_info/index_nodes.info
index ed5df43acc..5953973337 100644
Binary files a/tp/t/results/indices/index_nodes/res_info/index_nodes.info and 
b/tp/t/results/indices/index_nodes/res_info/index_nodes.info differ
diff --git a/tp/t/results/indices/index_nodes/res_plaintext/a-node.txt 
b/tp/t/results/indices/index_nodes/res_plaintext/a-node.txt
index 4db76c428e..7552750cb2 100644
--- a/tp/t/results/indices/index_nodes/res_plaintext/a-node.txt
+++ b/tp/t/results/indices/index_nodes/res_plaintext/a-node.txt
@@ -1,22 +1,22 @@
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line  0)
 * another:                               another.              (line 48)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line 49)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line 49)
 
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line 60)
 * another:                               another.              (line 48)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line 49)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line 49)
 
diff --git a/tp/t/results/indices/index_nodes/res_plaintext/chap-first.txt 
b/tp/t/results/indices/index_nodes/res_plaintext/chap-first.txt
index 6bb92e358b..5598295985 100644
--- a/tp/t/results/indices/index_nodes/res_plaintext/chap-first.txt
+++ b/tp/t/results/indices/index_nodes/res_plaintext/chap-first.txt
@@ -2,12 +2,12 @@ Text and then index entries
 
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line  0)
 * another:                               another.              (line  0)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line  0)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line  0)
 
diff --git a/tp/t/results/indices/index_nodes/res_plaintext/second.txt 
b/tp/t/results/indices/index_nodes/res_plaintext/second.txt
index f3319eb7fc..297d757c79 100644
--- a/tp/t/results/indices/index_nodes/res_plaintext/second.txt
+++ b/tp/t/results/indices/index_nodes/res_plaintext/second.txt
@@ -1,6 +1,6 @@
 * Menu:
 
 * a function:                            a node.               (line  0)
-* fun in node:                           chap first.           (line 31)
+* fun in node:                           chap first.           (line 30)
 * somewhere:                             another.              (line  0)
 
diff --git a/tp/t/results/indices/index_nodes_no_split_no_use_nodes.pl 
b/tp/t/results/indices/index_nodes_no_split_no_use_nodes.pl
index 6ff1618f56..59224d4786 100644
--- a/tp/t/results/indices/index_nodes_no_split_no_use_nodes.pl
+++ b/tp/t/results/indices/index_nodes_no_split_no_use_nodes.pl
@@ -401,157 +401,157 @@ $result_trees{'index_nodes_no_split_no_use_nodes'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 20,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 20,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 21,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 21,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 22,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 22,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_nodes.texi',
+                'line_nr' => 23,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_nodes.texi',
-            'line_nr' => 23,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1452,11 +1452,11 @@ 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[1]{'contents'}[0]
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[1]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[1]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'args'}[2]{'contents'}[0];
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'args'}[3]{'contents'}[0];
-$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
-$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
-$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
-$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
-$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[8]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[8]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
+$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
+$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
+$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[0]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2];
+$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[2]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'args'}[3]{'contents'}[0];
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_nodes_no_split_no_use_nodes'}{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_html/index_nodes.html
 
b/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_html/index_nodes.html
index ef14fb4564..836cc015f5 100644
--- 
a/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_html/index_nodes.html
+++ 
b/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_html/index_nodes.html
@@ -147,11 +147,11 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 
 
 <a class="node" id="chap-first"></a><p>Text and then index entries
-</p><a class="index-entry-id" id="index-entry-in-node"></a>
+<a class="index-entry-id" id="index-entry-in-node"></a>
 <a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node-1"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chap-first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git 
a/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_plaintext/index_nodes_no_split_no_use_nodes.txt
 
b/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_plaintext/index_nodes_no_split_no_use_nodes.txt
index 8e018367f3..d0d894d372 100644
--- 
a/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_plaintext/index_nodes_no_split_no_use_nodes.txt
+++ 
b/tp/t/results/indices/index_nodes_no_split_no_use_nodes/res_plaintext/index_nodes_no_split_no_use_nodes.txt
@@ -32,40 +32,40 @@ Text and then index entries
 
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line  0)
 * another:                               another.              (line  0)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line  0)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line  0)
 
 * Menu:
 
 * a function:                            a node.               (line  0)
-* fun in node:                           chap first.           (line 31)
+* fun in node:                           chap first.           (line 30)
 * somewhere:                             another.              (line  0)
 
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line  0)
 * another:                               another.              (line 48)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line 49)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line 49)
 
 * Menu:
 
-* ! entry in node:                       chap first.           (line 31)
+* ! entry in node:                       chap first.           (line 30)
 * a concept a node:                      a node.               (line 60)
 * another:                               another.              (line 48)
 * entry a:                               Top.                  (line  0)
 * entry after printindex:                a node.               (line 49)
-* entry in node:                         chap first.           (line 31)
-* entry in node <1>:                     chap first.           (line 31)
+* entry in node:                         chap first.           (line 30)
+* entry in node <1>:                     chap first.           (line 30)
 * something:                             another.              (line 49)
 
diff --git a/tp/t/results/indices/index_split.pl 
b/tp/t/results/indices/index_split.pl
index 169f8c7061..9798e05c7d 100644
--- a/tp/t/results/indices/index_split.pl
+++ b/tp/t/results/indices/index_split.pl
@@ -494,157 +494,157 @@ $result_trees{'index_split'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 24,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 24,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 25,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 25,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 26,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 26,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 27,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 27,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -2740,11 +2740,11 @@ 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[0]{'extra'}{'element_nod
 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split'}{'contents'}[2]{'contents'}[10]{'contents'}[2]{'contents'}[1]{'contents'}[0];
-$result_trees{'index_split'}{'contents'}[3]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
-$result_trees{'index_split'}{'contents'}[3]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
-$result_trees{'index_split'}{'contents'}[3]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
-$result_trees{'index_split'}{'contents'}[3]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
-$result_trees{'index_split'}{'contents'}[3]{'contents'}[11]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
+$result_trees{'index_split'}{'contents'}[3]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
+$result_trees{'index_split'}{'contents'}[3]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
+$result_trees{'index_split'}{'contents'}[3]{'contents'}[1]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
+$result_trees{'index_split'}{'contents'}[3]{'contents'}[1]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
+$result_trees{'index_split'}{'contents'}[3]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
 
$result_trees{'index_split'}{'contents'}[4]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
 
$result_trees{'index_split'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
 
$result_trees{'index_split'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split'}{'contents'}[3];
diff --git a/tp/t/results/indices/index_split/res_html/first.html 
b/tp/t/results/indices/index_split/res_html/first.html
index a4e2404ac4..56d630206e 100644
--- a/tp/t/results/indices/index_split/res_html/first.html
+++ b/tp/t/results/indices/index_split/res_html/first.html
@@ -40,11 +40,11 @@ Next: <a href="second-chapter.html" accesskey="n" 
rel="next">Second chapter</a>,
 <hr>
 
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-entry-in-node"></a>
+<a class="index-entry-id" id="index-entry-in-node"></a>
 <a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node-1"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/index_split_split_chapter_no_nodes.pl 
b/tp/t/results/indices/index_split_split_chapter_no_nodes.pl
index d128ea71b4..64ff845c57 100644
--- a/tp/t/results/indices/index_split_split_chapter_no_nodes.pl
+++ b/tp/t/results/indices/index_split_split_chapter_no_nodes.pl
@@ -494,157 +494,157 @@ $result_trees{'index_split_split_chapter_no_nodes'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 24,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 24,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 25,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 25,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 26,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 26,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_split.texi',
+                'line_nr' => 27,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_split.texi',
-            'line_nr' => 27,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -2740,11 +2740,11 @@ 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[0
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[2]{'contents'}[10]{'contents'}[2]{'contents'}[1]{'contents'}[0];
-$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
-$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
-$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
-$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
-$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[11]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
+$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
+$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
+$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[1]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
+$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[1]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
+$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
 
$result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_split_split_chapter_no_nodes'}{'contents'}[3];
diff --git 
a/tp/t/results/indices/index_split_split_chapter_no_nodes/res_html/first.html 
b/tp/t/results/indices/index_split_split_chapter_no_nodes/res_html/first.html
index 1f58ecfd55..30386ecdaf 100644
--- 
a/tp/t/results/indices/index_split_split_chapter_no_nodes/res_html/first.html
+++ 
b/tp/t/results/indices/index_split_split_chapter_no_nodes/res_html/first.html
@@ -39,11 +39,11 @@ Next: <a href="second-chapter.html" accesskey="n" 
rel="next">Second chapter</a>,
 </div>
 
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-entry-in-node"></a>
+<a class="index-entry-id" id="index-entry-in-node"></a>
 <a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node-1"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#First-chapter_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/index_table.pl 
b/tp/t/results/indices/index_table.pl
index d97a9407b1..61485327f9 100644
--- a/tp/t/results/indices/index_table.pl
+++ b/tp/t/results/indices/index_table.pl
@@ -394,46 +394,46 @@ $result_trees{'index_table'} = {
             {
               'text' => 'Some text
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'an second index entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'an second index entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_table.texi',
+                'line_nr' => 17,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_table.texi',
-            'line_nr' => 17,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -6151,14 +6151,14 @@ 
$result_trees{'index_table'}{'contents'}[2]{'contents'}[0]{'contents'}[0]{'conte
 
$result_trees{'index_table'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[8]{'extra'}{'command_as_argument'}
 = $result_trees{'index_table'}{'contents'}[4]{'contents'}[8]{'args'}[0];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[11]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
-$result_trees{'index_table'}{'contents'}[4]{'contents'}[11]{'extra'}{'command_as_argument'}
 = $result_trees{'index_table'}{'contents'}[4]{'contents'}[11]{'args'}[0];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[3]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[7]{'extra'}{'command_as_argument'}
 = $result_trees{'index_table'}{'contents'}[4]{'contents'}[7]{'args'}[0];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[10]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[10]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[10]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[3];
+$result_trees{'index_table'}{'contents'}[4]{'contents'}[10]{'extra'}{'command_as_argument'}
 = $result_trees{'index_table'}{'contents'}[4]{'contents'}[10]{'args'}[0];
 
$result_trees{'index_table'}{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table'}{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table'}{'contents'}[8]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[7];
 
$result_trees{'index_table'}{'contents'}[8]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_table'}{'contents'}[7];
diff --git 
a/tp/t/results/indices/index_table/res_html/node-with-ftable-and-vtable.html 
b/tp/t/results/indices/index_table/res_html/node-with-ftable-and-vtable.html
index 785db4b747..bef993b821 100644
--- a/tp/t/results/indices/index_table/res_html/node-with-ftable-and-vtable.html
+++ b/tp/t/results/indices/index_table/res_html/node-with-ftable-and-vtable.html
@@ -39,8 +39,8 @@ Next: <a href="node-with-printindex.html" accesskey="n" 
rel="next">node with pri
 <a class="index-entry-id" id="index-index-entry-in-node"></a>
 
 <p>Some text
-</p><a class="index-entry-id" id="index-an-second-index-entry-in-node"></a>
-
+<a class="index-entry-id" id="index-an-second-index-entry-in-node"></a>
+</p>
 
 
 <dl class="vtable">
diff --git a/tp/t/results/indices/index_table/res_info/index_table.info 
b/tp/t/results/indices/index_table/res_info/index_table.info
index 094402580a..f896195b37 100644
Binary files a/tp/t/results/indices/index_table/res_info/index_table.info and 
b/tp/t/results/indices/index_table/res_info/index_table.info differ
diff --git a/tp/t/results/indices/index_table/res_plaintext/index_table.txt 
b/tp/t/results/indices/index_table/res_plaintext/index_table.txt
index afc12cf6f7..772317dea9 100644
--- a/tp/t/results/indices/index_table/res_plaintext/index_table.txt
+++ b/tp/t/results/indices/index_table/res_plaintext/index_table.txt
@@ -44,7 +44,7 @@ more fun
 * ?oncept:                               indices refs.          (line 0)
 * /oncept:                               indices refs.          (line 0)
 * an second index entry in node:         node with ftable and vtable.
-                                                                (line 7)
+                                                                (line 6)
 * aoncept:                               indices refs.          (line 0)
 * boncept:                               indices refs.          (line 0)
 * c,ncept:                               indices refs.          (line 0)
@@ -182,7 +182,7 @@ more fun
 * ?oncept:                               indices refs.        (line 176)
 * /oncept:                               indices refs.        (line 176)
 * an second index entry in node:         node with ftable and vtable.
-                                                              (line   7)
+                                                              (line   6)
 * aoncept:                               indices refs.        (line 176)
 * boncept:                               indices refs.        (line 176)
 * c,ncept:                               indices refs.        (line 176)
diff --git a/tp/t/results/indices/index_table_chapter_no_node.pl 
b/tp/t/results/indices/index_table_chapter_no_node.pl
index 9b14bd19f2..83e164e66a 100644
--- a/tp/t/results/indices/index_table_chapter_no_node.pl
+++ b/tp/t/results/indices/index_table_chapter_no_node.pl
@@ -394,46 +394,46 @@ $result_trees{'index_table_chapter_no_node'} = {
             {
               'text' => 'Some text
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'an second index entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'an second index entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'index_table.texi',
+                'line_nr' => 17,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'index_table.texi',
-            'line_nr' => 17,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -6151,14 +6151,14 @@ 
$result_trees{'index_table_chapter_no_node'}{'contents'}[2]{'contents'}[0]{'cont
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[2]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[2]{'contents'}[0]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[8]{'extra'}{'command_as_argument'}
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[8]{'args'}[0];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[11]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
-$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[11]{'extra'}{'command_as_argument'}
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[11]{'args'}[0];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[3]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[7]{'args'}[0];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[10]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[10]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[10]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[3];
+$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[10]{'extra'}{'command_as_argument'}
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[4]{'contents'}[10]{'args'}[0];
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'index_table_chapter_no_node'}{'contents'}[8]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[8]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[7];
 
$result_trees{'index_table_chapter_no_node'}{'contents'}[8]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'index_table_chapter_no_node'}{'contents'}[7];
diff --git 
a/tp/t/results/indices/index_table_chapter_no_node/res_html/node-with-ftable-and-vtable.html
 
b/tp/t/results/indices/index_table_chapter_no_node/res_html/node-with-ftable-and-vtable.html
index 5aa02ca6b9..18b3b6ceae 100644
--- 
a/tp/t/results/indices/index_table_chapter_no_node/res_html/node-with-ftable-and-vtable.html
+++ 
b/tp/t/results/indices/index_table_chapter_no_node/res_html/node-with-ftable-and-vtable.html
@@ -38,8 +38,8 @@ Next: <a href="node-with-printindex.html" accesskey="n" 
rel="next">node with pri
 <a class="index-entry-id" id="index-index-entry-in-node"></a>
 
 <p>Some text
-</p><a class="index-entry-id" id="index-an-second-index-entry-in-node"></a>
-
+<a class="index-entry-id" id="index-an-second-index-entry-in-node"></a>
+</p>
 
 
 <dl class="vtable">
diff --git 
a/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/indices-refs.txt
 
b/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/indices-refs.txt
index 1c55bad493..c852c9db61 100644
--- 
a/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/indices-refs.txt
+++ 
b/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/indices-refs.txt
@@ -9,7 +9,7 @@
 * ?oncept:                               indices refs.        (line 176)
 * /oncept:                               indices refs.        (line 176)
 * an second index entry in node:         node with ftable and vtable.
-                                                              (line   7)
+                                                              (line   6)
 * aoncept:                               indices refs.        (line 176)
 * boncept:                               indices refs.        (line 176)
 * c,ncept:                               indices refs.        (line 176)
diff --git 
a/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/node-with-printindex.txt
 
b/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/node-with-printindex.txt
index d7a3b28006..a901b4d644 100644
--- 
a/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/node-with-printindex.txt
+++ 
b/tp/t/results/indices/index_table_chapter_no_node/res_plaintext/node-with-printindex.txt
@@ -25,7 +25,7 @@
 * ?oncept:                               indices refs.          (line 0)
 * /oncept:                               indices refs.          (line 0)
 * an second index entry in node:         node with ftable and vtable.
-                                                                (line 7)
+                                                                (line 6)
 * aoncept:                               indices refs.          (line 0)
 * boncept:                               indices refs.          (line 0)
 * c,ncept:                               indices refs.          (line 0)
diff --git a/tp/t/results/indices/nodes_before_top.pl 
b/tp/t/results/indices/nodes_before_top.pl
index 049d3c696f..4d2e0fd0a8 100644
--- a/tp/t/results/indices/nodes_before_top.pl
+++ b/tp/t/results/indices/nodes_before_top.pl
@@ -901,120 +901,120 @@ $result_trees{'nodes_before_top'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  5
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              5
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 40,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 40,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 41,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 41,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 42,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 42,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1923,10 +1923,10 @@ 
$result_trees{'nodes_before_top'}{'contents'}[3]{'contents'}[0]{'extra'}{'elemen
 
$result_trees{'nodes_before_top'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top'}{'contents'}[4]{'args'}[2]{'extra'}{'node_content'}[0]
 = $result_trees{'nodes_before_top'}{'contents'}[4]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top'}{'contents'}[4]{'args'}[3]{'extra'}{'node_content'}[0]
 = $result_trees{'nodes_before_top'}{'contents'}[4]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
-$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
-$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
-$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
+$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
+$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top'}{'contents'}[4];
+$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = $result_trees{'nodes_before_top'}{'contents'}[5]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git a/tp/t/results/indices/nodes_before_top/res_html/chap-first.html 
b/tp/t/results/indices/nodes_before_top/res_html/chap-first.html
index ce4cceb36a..62561368a8 100644
--- a/tp/t/results/indices/nodes_before_top/res_html/chap-first.html
+++ b/tp/t/results/indices/nodes_before_top/res_html/chap-first.html
@@ -38,10 +38,10 @@ Previous: <a href="index.html" accesskey="p" 
rel="prev">Top</a>, Up: <a href="in
 <hr>
 <h4 class="node"><span>chap first<a class="copiable-link" href="#chap-first"> 
&para;</a></span></h4>
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chap-first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/nodes_before_top_and_sections_chapter.pl 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter.pl
index e73f5e917f..e78b63d522 100644
--- a/tp/t/results/indices/nodes_before_top_and_sections_chapter.pl
+++ b/tp/t/results/indices/nodes_before_top_and_sections_chapter.pl
@@ -1130,120 +1130,120 @@ 
$result_trees{'nodes_before_top_and_sections_chapter'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 49,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 49,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 50,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 50,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  7
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 51,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              7
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 51,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -2412,10 +2412,10 @@ 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[4]{'contents'
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/nodes_before_top_and_sections_chapter/res_html/index.html
 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter/res_html/index.html
index 8c9cf0d2bc..0efd495778 100644
--- 
a/tp/t/results/indices/nodes_before_top_and_sections_chapter/res_html/index.html
+++ 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter/res_html/index.html
@@ -227,10 +227,10 @@ Previous: <a href="#Top" accesskey="p" rel="prev">top 
section</a>, Up: <a href="
 </div>
 <h4 class="node"><span>first<a class="copiable-link" href="#first"> 
&para;</a></span></h4>
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git 
a/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node.pl 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node.pl
index 8d12be9d85..ae53d975aa 100644
--- a/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node.pl
+++ b/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node.pl
@@ -1130,120 +1130,120 @@ 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 49,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 49,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 50,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 50,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  7
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 51,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              7
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 51,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -2412,10 +2412,10 @@ 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[4]{'c
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[1]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[2]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[3]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_chapter_no_node'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node/res_html/index.html
 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node/res_html/index.html
index b66d26cd37..56bd2e6677 100644
--- 
a/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node/res_html/index.html
+++ 
b/tp/t/results/indices/nodes_before_top_and_sections_chapter_no_node/res_html/index.html
@@ -445,10 +445,10 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 <li><a href="chapter.html" accesskey="1">A chapter</a></li>
 </ul>
 <a class="node" id="first"></a><p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#top-section_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git 
a/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes.pl 
b/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes.pl
index 099afeeba9..52b010c29b 100644
--- a/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes.pl
+++ b/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes.pl
@@ -1130,120 +1130,120 @@ 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 49,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 49,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 50,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 50,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  7
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top_and_sections.texi',
+                'line_nr' => 51,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              7
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top_and_sections.texi',
-            'line_nr' => 51,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -2412,10 +2412,10 @@ 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[4]{'
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[4]{'contents'}[4]{'contents'}[2]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[1]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[2]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[3]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
-$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5];
+$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[5]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_and_sections_unsplit_no_nodes'}{'contents'}[6]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes/res_html/nodes_before_top_and_sections.html
 
b/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes/res_html/nodes_before_top_and_sections.html
index 83ef8c5fbd..bcab338bbd 100644
--- 
a/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes/res_html/nodes_before_top_and_sections.html
+++ 
b/tp/t/results/indices/nodes_before_top_and_sections_unsplit_no_nodes/res_html/nodes_before_top_and_sections.html
@@ -445,10 +445,10 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 <li><a href="#chapter" accesskey="1">A chapter</a></li>
 </ul>
 <a class="node" id="first"></a><p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#top-section_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/nodes_before_top_split_chapter.pl 
b/tp/t/results/indices/nodes_before_top_split_chapter.pl
index 6cebeb8a06..6e754a9841 100644
--- a/tp/t/results/indices/nodes_before_top_split_chapter.pl
+++ b/tp/t/results/indices/nodes_before_top_split_chapter.pl
@@ -901,120 +901,120 @@ $result_trees{'nodes_before_top_split_chapter'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  5
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              5
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 40,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 40,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 41,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 41,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 42,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 42,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1923,10 +1923,10 @@ 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[3]{'contents'}[0]{'e
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/nodes_before_top_split_chapter/res_html/first-before-top.html
 
b/tp/t/results/indices/nodes_before_top_split_chapter/res_html/first-before-top.html
index 93cce4da6e..abeb2df034 100644
--- 
a/tp/t/results/indices/nodes_before_top_split_chapter/res_html/first-before-top.html
+++ 
b/tp/t/results/indices/nodes_before_top_split_chapter/res_html/first-before-top.html
@@ -185,10 +185,10 @@ Previous: <a href="index.html" accesskey="p" 
rel="prev">Top</a>, Up: <a href="in
 </div>
 <h4 class="node"><span>chap first<a class="copiable-link" href="#chap-first"> 
&para;</a></span></h4>
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chap-first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes.pl 
b/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes.pl
index c6fdd48129..ab1aada58a 100644
--- a/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes.pl
+++ b/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes.pl
@@ -901,120 +901,120 @@ 
$result_trees{'nodes_before_top_split_chapter_no_nodes'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  5
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              5
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 40,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 40,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 41,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 41,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  6
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'nodes_before_top.texi',
+                'line_nr' => 42,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              6
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'nodes_before_top.texi',
-            'line_nr' => 42,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1923,10 +1923,10 @@ 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[3]{'content
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[3]{'contents'}[10]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'args'}[2]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'args'}[2]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'args'}[3]{'contents'}[0];
-$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
-$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4];
+$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[4]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'args'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'args'}[3]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nodes_before_top_split_chapter_no_nodes'}{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[0];
diff --git 
a/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes/res_html/index.html
 
b/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes/res_html/index.html
index f242c5d650..ae3e2c2b2f 100644
--- 
a/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes/res_html/index.html
+++ 
b/tp/t/results/indices/nodes_before_top_split_chapter_no_nodes/res_html/index.html
@@ -323,10 +323,10 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 
 
 <a class="node" id="chap-first"></a><p>Text and then index entries
-</p><a class="index-entry-id" id="index-_0021-entry-in-node"></a>
+<a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#chap-first_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git 
a/tp/t/results/indices/printindex_index_entry_in_copying_in_footnote.pl 
b/tp/t/results/indices/printindex_index_entry_in_copying_in_footnote.pl
index 9b89c0b841..7408b8584c 100644
--- a/tp/t/results/indices/printindex_index_entry_in_copying_in_footnote.pl
+++ b/tp/t/results/indices/printindex_index_entry_in_copying_in_footnote.pl
@@ -44,46 +44,46 @@ 
$result_trees{'printindex_index_entry_in_copying_in_footnote'} = {
                                 {
                                   'text' => 'In footnote
 '
-                                }
-                              ],
-                              'type' => 'paragraph'
-                            },
-                            {
-                              'args' => [
+                                },
                                 {
-                                  'contents' => [
+                                  'args' => [
                                     {
-                                      'text' => 'Copying this document'
+                                      'contents' => [
+                                        {
+                                          'text' => 'Copying this document'
+                                        }
+                                      ],
+                                      'info' => {
+                                        'spaces_after_argument' => {
+                                          'text' => '
+'
+                                        }
+                                      },
+                                      'type' => 'line_arg'
                                     }
                                   ],
+                                  'cmdname' => 'cindex',
+                                  'extra' => {
+                                    'element_region' => 'copying',
+                                    'index_entry' => [
+                                      'cp',
+                                      1
+                                    ]
+                                  },
                                   'info' => {
-                                    'spaces_after_argument' => {
-                                      'text' => '
-'
+                                    'spaces_before_argument' => {
+                                      'text' => ' '
                                     }
                                   },
-                                  'type' => 'line_arg'
+                                  'source_info' => {
+                                    'file_name' => '',
+                                    'line_nr' => 5,
+                                    'macro' => ''
+                                  },
+                                  'type' => 'index_entry_command'
                                 }
                               ],
-                              'cmdname' => 'cindex',
-                              'extra' => {
-                                'element_region' => 'copying',
-                                'index_entry' => [
-                                  'cp',
-                                  1
-                                ]
-                              },
-                              'info' => {
-                                'spaces_before_argument' => {
-                                  'text' => ' '
-                                }
-                              },
-                              'source_info' => {
-                                'file_name' => '',
-                                'line_nr' => 5,
-                                'macro' => ''
-                              },
-                              'type' => 'index_entry_command'
+                              'type' => 'paragraph'
                             },
                             {
                               'text' => '
@@ -817,12 +817,12 @@ 
$result_converted{'html_text'}->{'printindex_index_entry_in_copying_in_footnote'
 
 <h5 class="footnote-body-heading"><a id="FOOT1" href="#DOCF1">(1)</a></h5>
 <p>In footnote
-</p><a class="index-entry-id" id="index-copying-Copying-this-document"></a>
-
+<a class="index-entry-id" id="index-copying-Copying-this-document"></a>
+</p>
 <h5 class="footnote-body-heading"><a id="FOOT1_2" href="#DOCF1_2">(2)</a></h5>
 <p>In footnote
-</p><a class="index-entry-id" id="index-copying-Copying-this-document"></a>
-
+<a class="index-entry-id" id="index-copying-Copying-this-document"></a>
+</p>
 </div>
 ';
 
@@ -830,8 +830,8 @@ 
$result_converted{'html_text'}->{'printindex_index_entry_in_copying_in_footnote'
 $result_converted{'xml'}->{'printindex_index_entry_in_copying_in_footnote'} = 
'<copying endspaces=" ">
 
 <para>Copying<footnote spaces="\\n"><para>In footnote
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="1">Copying 
this document</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="1">Copying this 
document</indexterm></cindex>
+</para>
 </footnote>.
 </para>
 <printindex spaces=" " value="cp" line="cp"></printindex>
diff --git a/tp/t/results/indices/split_chapter_index.pl 
b/tp/t/results/indices/split_chapter_index.pl
index 8b576cb966..92317ba850 100644
--- a/tp/t/results/indices/split_chapter_index.pl
+++ b/tp/t/results/indices/split_chapter_index.pl
@@ -365,157 +365,157 @@ $result_trees{'split_chapter_index'} = {
             {
               'text' => 'Text and then index entries
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'split_chapter_index.texi',
-            'line_nr' => 20,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'split_chapter_index.texi',
+                'line_nr' => 20,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '! entry in node'
+                  'contents' => [
+                    {
+                      'text' => '! entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'split_chapter_index.texi',
-            'line_nr' => 21,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'split_chapter_index.texi',
+                'line_nr' => 21,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'fun in node'
+                  'contents' => [
+                    {
+                      'text' => 'fun in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'split_chapter_index.texi',
-            'line_nr' => 22,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => 'split_chapter_index.texi',
+                'line_nr' => 22,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'entry in node'
+                  'contents' => [
+                    {
+                      'text' => 'entry in node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => 'split_chapter_index.texi',
+                'line_nr' => 23,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => 'split_chapter_index.texi',
-            'line_nr' => 23,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1233,15 +1233,15 @@ $result_trees{'split_chapter_index'} = {
 };
 
$result_trees{'split_chapter_index'}{'contents'}[2]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[1];
 
$result_trees{'split_chapter_index'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'split_chapter_index'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[0];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[1]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[1]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
 
$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[8]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
 
$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[9]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[11]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[12]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[13]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[3];
-$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[15]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'split_chapter_index'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'split_chapter_index'}{'contents'}[6]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'split_chapter_index'}{'contents'}[6]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'split_chapter_index'}{'contents'}[6]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[5];
 
$result_trees{'split_chapter_index'}{'contents'}[6]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'split_chapter_index'}{'contents'}[5];
diff --git a/tp/t/results/indices/split_chapter_index/res_html/first.html 
b/tp/t/results/indices/split_chapter_index/res_html/first.html
index 53baeb49e9..06287007b9 100644
--- a/tp/t/results/indices/split_chapter_index/res_html/first.html
+++ b/tp/t/results/indices/split_chapter_index/res_html/first.html
@@ -39,11 +39,11 @@ th.sections-header-printindex {text-align:left; 
padding-left: 1em}
 <h2 class="chapter" id="First-chapter"><span>1 First chapter<a 
class="copiable-link" href="#First-chapter"> &para;</a></span></h2>
 
 <p>Text and then index entries
-</p><a class="index-entry-id" id="index-entry-in-node"></a>
+<a class="index-entry-id" id="index-entry-in-node"></a>
 <a class="index-entry-id" id="index-_0021-entry-in-node"></a>
 <a class="index-entry-id" id="index-fun-in-node"></a>
 <a class="index-entry-id" id="index-entry-in-node-1"></a>
-
+</p>
 <div class="printindex cp-printindex">
 <table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; 
</th><td><a class="summary-letter-printindex" 
href="#First-chapter_cp_symbol-1"><b>!</b></a>
  &nbsp; 
diff --git a/tp/t/results/indices/unknown_then_known_index_entry.pl 
b/tp/t/results/indices/unknown_then_known_index_entry.pl
index f1e78d5893..64acc2db95 100644
--- a/tp/t/results/indices/unknown_then_known_index_entry.pl
+++ b/tp/t/results/indices/unknown_then_known_index_entry.pl
@@ -52,45 +52,45 @@ $result_trees{'unknown_then_known_index_entry'} = {
                 'line_nr' => 2,
                 'macro' => ''
               }
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'someindex entry.'
+                  'contents' => [
+                    {
+                      'text' => 'someindex entry.'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'someindex',
+              'extra' => {
+                'index_entry' => [
+                  'some',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'someindex',
-          'extra' => {
-            'index_entry' => [
-              'some',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 3,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/t/results/info_tests/before_node_and_section.pl 
b/tp/t/results/info_tests/before_node_and_section.pl
index 4d9d4b2945..9ba7a4343a 100644
--- a/tp/t/results/info_tests/before_node_and_section.pl
+++ b/tp/t/results/info_tests/before_node_and_section.pl
@@ -45,48 +45,43 @@ $result_trees{'before_node_and_section'} = {
             {
               'text' => '.
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'index entry before anything'
+                  'contents' => [
+                    {
+                      'text' => 'index entry before anything'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => ' 
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => ' 
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 3,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'contents' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
               'text' => 'Hey'
             },
@@ -629,7 +624,7 @@ $result_trees{'before_node_and_section'} = {
   'type' => 'document_root'
 };
 
$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[0]{'contents'}[2]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
-$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'before_node_and_section'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
$result_trees{'before_node_and_section'}{'contents'}[2]{'contents'}[2]{'contents'}[5]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'before_node_and_section'}{'contents'}[2]{'contents'}[2]{'contents'}[5]{'args'}[0]{'contents'}[0];
 
$result_trees{'before_node_and_section'}{'contents'}[2]{'contents'}[3]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'before_node_and_section'}{'contents'}[2]{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[0];
 
@@ -820,8 +815,7 @@ $result_indices_sort_strings{'before_node_and_section'} = {
 
 $result_converted{'info'}->{'before_node_and_section'} = 'This is , produced 
from .
 
-Garbage ref to Top *note Top::.
-   Hey(1).  An anchor .
+Garbage ref to Top *note Top::.  Hey(1).  An anchor .
 
 * Menu:
 
@@ -860,11 +854,11 @@ File: ,  Node: node1,  Prev: Top,  Up: Top
 
 
 Tag Table:
-Ref: anchor180
-Node: Top104
-Ref: Top-Footnote-1319
-Ref: Top-Footnote-2338
-Node: node1363
+Ref: anchor178
+Node: Top102
+Ref: Top-Footnote-1317
+Ref: Top-Footnote-2336
+Node: node1361
 
 End Tag Table
 
diff --git a/tp/t/results/info_tests/multitable_anchor_and_index_entry.pl 
b/tp/t/results/info_tests/multitable_anchor_and_index_entry.pl
index 29d6167fca..d66023fcd3 100644
--- a/tp/t/results/info_tests/multitable_anchor_and_index_entry.pl
+++ b/tp/t/results/info_tests/multitable_anchor_and_index_entry.pl
@@ -253,72 +253,72 @@ $result_trees{'multitable_anchor_and_index_entry'} = {
                             {
                               'text' => 'multitable tab 2
 '
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'index entry within multitable'
+                                  'contents' => [
+                                    {
+                                      'text' => 'index entry within multitable'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'cindex',
+                              'extra' => {
+                                'element_node' => {},
+                                'index_entry' => [
+                                  'cp',
+                                  1
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
-                            }
-                          ],
-                          'cmdname' => 'cindex',
-                          'extra' => {
-                            'element_node' => {},
-                            'index_entry' => [
-                              'cp',
-                              1
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 8,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
-                        },
-                        {
-                          'args' => [
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 8,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'anchor in multitable'
+                                  'contents' => [
+                                    {
+                                      'text' => 'anchor in multitable'
+                                    }
+                                  ],
+                                  'type' => 'brace_command_arg'
                                 }
                               ],
-                              'type' => 'brace_command_arg'
+                              'cmdname' => 'anchor',
+                              'extra' => {
+                                'normalized' => 'anchor-in-multitable'
+                              },
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 9,
+                                'macro' => ''
+                              }
+                            },
+                            {
+                              'text' => '
+',
+                              'type' => 'spaces_after_close_brace'
                             }
                           ],
-                          'cmdname' => 'anchor',
-                          'extra' => {
-                            'normalized' => 'anchor-in-multitable'
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 9,
-                            'macro' => ''
-                          }
-                        },
-                        {
-                          'text' => '
-',
-                          'type' => 'spaces_after_close_brace'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
@@ -559,46 +559,46 @@ $result_trees{'multitable_anchor_and_index_entry'} = {
                             {
                               'text' => 'mlsdmjlfdsjm mdsfk 
 '
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'index entry'
+                                  'contents' => [
+                                    {
+                                      'text' => 'index entry'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'cindex',
+                              'extra' => {
+                                'element_node' => {},
+                                'index_entry' => [
+                                  'cp',
+                                  2
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 21,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
                             }
                           ],
-                          'cmdname' => 'cindex',
-                          'extra' => {
-                            'element_node' => {},
-                            'index_entry' => [
-                              'cp',
-                              2
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 21,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
@@ -897,9 +897,9 @@ $result_trees{'multitable_anchor_and_index_entry'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1];
+$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1];
 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[1]{'extra'}{'columnfractions'}
 = 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[1]{'args'}[0]{'contents'}[0];
-$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1];
+$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[3]{'contents'}[0]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1];
 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[6]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[6]{'contents'}[0]{'args'}[0]{'contents'}[0];
 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[6]{'contents'}[2]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'multitable_anchor_and_index_entry'}{'contents'}[1]{'contents'}[6]{'contents'}[2]{'args'}[0]{'contents'}[0];
 
@@ -1003,7 +1003,6 @@ mu-ltitable headitem          another tab
 --------------------------------------------------------------------------
 mu-ltitable item              multitable tab
 mu-ltitable item 2            multitable tab 2
-                              
 lone mu-ltitable item
 
 A   G
@@ -1026,16 +1025,16 @@ mdsfk2
 [index]
 * Menu:
 
-* index entry:                           Top.                  (line 20)
-* index entry within multitable:         Top.                  (line  7)
+* index entry:                           Top.                  (line 19)
+* index entry within multitable:         Top.                  (line  6)
 
    *note mark:: *note anchor in multitable::
 
 
 Tag Table:
 Node: Top27
-Ref: anchor in multitable300
-Ref: mark419
+Ref: anchor in multitable269
+Ref: mark388
 
 End Tag Table
 
diff --git a/tp/t/results/info_tests/nested_multitable_anchor_index.pl 
b/tp/t/results/info_tests/nested_multitable_anchor_index.pl
index 2246c19b33..51c04e4c18 100644
--- a/tp/t/results/info_tests/nested_multitable_anchor_index.pl
+++ b/tp/t/results/info_tests/nested_multitable_anchor_index.pl
@@ -182,46 +182,46 @@ $result_trees{'nested_multitable_anchor_index'} = {
                                               'text' => '
 ',
                                               'type' => 
'spaces_after_close_brace'
-                                            }
-                                          ],
-                                          'type' => 'paragraph'
-                                        },
-                                        {
-                                          'args' => [
+                                            },
                                             {
-                                              'contents' => [
+                                              'args' => [
                                                 {
-                                                  'text' => 'index entry 
inside'
+                                                  'contents' => [
+                                                    {
+                                                      'text' => 'index entry 
inside'
+                                                    }
+                                                  ],
+                                                  'info' => {
+                                                    'spaces_after_argument' => 
{
+                                                      'text' => '
+'
+                                                    }
+                                                  },
+                                                  'type' => 'line_arg'
                                                 }
                                               ],
+                                              'cmdname' => 'cindex',
+                                              'extra' => {
+                                                'element_node' => {},
+                                                'index_entry' => [
+                                                  'cp',
+                                                  1
+                                                ]
+                                              },
                                               'info' => {
-                                                'spaces_after_argument' => {
-                                                  'text' => '
-'
+                                                'spaces_before_argument' => {
+                                                  'text' => ' '
                                                 }
                                               },
-                                              'type' => 'line_arg'
+                                              'source_info' => {
+                                                'file_name' => '',
+                                                'line_nr' => 7,
+                                                'macro' => ''
+                                              },
+                                              'type' => 'index_entry_command'
                                             }
                                           ],
-                                          'cmdname' => 'cindex',
-                                          'extra' => {
-                                            'element_node' => {},
-                                            'index_entry' => [
-                                              'cp',
-                                              1
-                                            ]
-                                          },
-                                          'info' => {
-                                            'spaces_before_argument' => {
-                                              'text' => ' '
-                                            }
-                                          },
-                                          'source_info' => {
-                                            'file_name' => '',
-                                            'line_nr' => 7,
-                                            'macro' => ''
-                                          },
-                                          'type' => 'index_entry_command'
+                                          'type' => 'paragraph'
                                         }
                                       ],
                                       'extra' => {
@@ -399,46 +399,46 @@ $result_trees{'nested_multitable_anchor_index'} = {
                               'text' => '
 ',
                               'type' => 'spaces_after_close_brace'
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'index entry'
+                                  'contents' => [
+                                    {
+                                      'text' => 'index entry'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'cindex',
+                              'extra' => {
+                                'element_node' => {},
+                                'index_entry' => [
+                                  'cp',
+                                  2
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 11,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
                             }
                           ],
-                          'cmdname' => 'cindex',
-                          'extra' => {
-                            'element_node' => {},
-                            'index_entry' => [
-                              'cp',
-                              2
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 11,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
@@ -630,8 +630,8 @@ $result_trees{'nested_multitable_anchor_index'} = {
   ],
   'type' => 'document_root'
 };
-$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nested_multitable_anchor_index'}{'contents'}[1];
-$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'nested_multitable_anchor_index'}{'contents'}[1];
+$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nested_multitable_anchor_index'}{'contents'}[1];
+$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'contents'}[1]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'nested_multitable_anchor_index'}{'contents'}[1];
 
$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[5]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[5]{'contents'}[0]{'args'}[0]{'contents'}[0];
 
$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[5]{'contents'}[2]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'nested_multitable_anchor_index'}{'contents'}[1]{'contents'}[5]{'contents'}[2]{'args'}[0]{'contents'}[0];
 
diff --git a/tp/t/results/info_tests/one_node_counted_elements.pl 
b/tp/t/results/info_tests/one_node_counted_elements.pl
index 34f1312348..df6b716fac 100644
--- a/tp/t/results/info_tests/one_node_counted_elements.pl
+++ b/tp/t/results/info_tests/one_node_counted_elements.pl
@@ -14,45 +14,45 @@ $result_trees{'one_node_counted_elements'} = {
             {
               'text' => 'Garbage
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'before nodes'
+                  'contents' => [
+                    {
+                      'text' => 'before nodes'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 2,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -111,46 +111,46 @@ $result_trees{'one_node_counted_elements'} = {
             {
               'text' => 'Top node
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'Top node'
+                  'contents' => [
+                    {
+                      'text' => 'Top node'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 6,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 6,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -418,9 +418,9 @@ $result_trees{'one_node_counted_elements'} = {
   'type' => 'document_root'
 };
 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'args'}[3]{'extra'}{'manual_content'}[0]
 = 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'args'}[3]{'contents'}[1];
-$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'one_node_counted_elements'}{'contents'}[1];
-$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'manual_content'}[0]
 = 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1];
-$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[8]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[8]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'one_node_counted_elements'}{'contents'}[1];
+$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'extra'}{'manual_content'}[0]
 = 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[4]{'contents'}[0]{'contents'}[1]{'contents'}[1];
+$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[7]{'contents'}[1]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'one_node_counted_elements'}{'contents'}[1]{'contents'}[7]{'contents'}[1]{'args'}[0]{'contents'}[0];
 
 $result_texis{'one_node_counted_elements'} = 'Garbage
 @cindex before nodes
@@ -561,7 +561,7 @@ Top node
 * Menu:
 
 * before nodes:                          (outside of any node). (line 0)
-* Top node:                              one node.              (line 4)
+* Top node:                              one node.              (line 3)
 
 
 
diff --git a/tp/t/results/info_tests/test_index.pl 
b/tp/t/results/info_tests/test_index.pl
index 812e1fed39..311813243c 100644
--- a/tp/t/results/info_tests/test_index.pl
+++ b/tp/t/results/info_tests/test_index.pl
@@ -109,167 +109,167 @@ $result_trees{'test_index'} = {
             {
               'text' => 'before menu.
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'in Top'
+                  'contents' => [
+                    {
+                      'text' => 'in Top'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 7,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 7,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'cmdname' => '@'
+                  'contents' => [
+                    {
+                      'cmdname' => '@'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  2
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              2
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 8,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 8,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'args' => [
+                  'contents' => [
                     {
-                      'type' => 'brace_command_arg'
+                      'args' => [
+                        {
+                          'type' => 'brace_command_arg'
+                        }
+                      ],
+                      'cmdname' => 'exclamdown',
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 9,
+                        'macro' => ''
+                      }
                     }
                   ],
-                  'cmdname' => 'exclamdown',
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 9,
-                    'macro' => ''
-                  }
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  3
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              3
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 9,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'args' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 9,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => '"'
+                  'contents' => [
+                    {
+                      'text' => '"'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'cp',
+                  4
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 10,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'cp',
-              4
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 10,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         },
         {
           'text' => '
@@ -1048,49 +1048,44 @@ $result_trees{'test_index'} = {
             {
               'text' => 'A paragraph 
 '
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'other function'
+                  'contents' => [
+                    {
+                      'text' => 'other function'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'findex',
+              'extra' => {
+                'element_node' => {},
+                'index_entry' => [
+                  'fn',
+                  7
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
-            }
-          ],
-          'cmdname' => 'findex',
-          'extra' => {
-            'element_node' => {},
-            'index_entry' => [
-              'fn',
-              7
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 38,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
-        },
-        {
-          'contents' => [
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 38,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
+            },
             {
               'text' => 'end paragraph
 '
@@ -2880,25 +2875,25 @@ $result_trees{'test_index'} = {
   'type' => 'document_root'
 };
 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[1]{'contents'}[0]{'args'}[0]{'extra'}{'node_content'}[0]
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[1]{'contents'}[0]{'args'}[0]{'contents'}[0];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[6]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[0]{'extra'}{'def_index_element'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[0]{'args'}[0]{'contents'}[2];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[1]{'extra'}{'def_index_element'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[1]{'args'}[0]{'contents'}[2];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[11]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[11]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[11]{'extra'}{'command_as_argument'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[11]{'args'}[0]{'contents'}[0];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[13]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[13]{'contents'}[0]{'contents'}[1]{'contents'}[0];
-$result_trees{'test_index'}{'contents'}[2]{'contents'}[13]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[13]{'contents'}[1]{'contents'}[1]{'contents'}[0];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[3]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[3]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[3]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[3]{'contents'}[4]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'extra'}{'def_index_element'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'args'}[0]{'contents'}[2];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[1]{'extra'}{'def_index_element'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[1]{'args'}[0]{'contents'}[2];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[5]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'contents'}[1]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'contents'}[1]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[1];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[0]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[0]{'contents'}[1]{'contents'}[0];
+$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[1]{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'test_index'}{'contents'}[2]{'contents'}[9]{'contents'}[1]{'contents'}[1]{'contents'}[0];
 
$result_trees{'test_index'}{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
 
$result_trees{'test_index'}{'contents'}[4]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
-$result_trees{'test_index'}{'contents'}[4]{'contents'}[5]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
-$result_trees{'test_index'}{'contents'}[4]{'contents'}[18]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
-$result_trees{'test_index'}{'contents'}[4]{'contents'}[170]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
+$result_trees{'test_index'}{'contents'}[4]{'contents'}[4]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
+$result_trees{'test_index'}{'contents'}[4]{'contents'}[16]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
+$result_trees{'test_index'}{'contents'}[4]{'contents'}[168]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[3];
 
$result_trees{'test_index'}{'contents'}[6]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[5];
 
$result_trees{'test_index'}{'contents'}[6]{'contents'}[7]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[5];
 
$result_trees{'test_index'}{'contents'}[11]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'test_index'}{'contents'}[5];
@@ -3671,8 +3666,7 @@ File: ,  Node: name,  Next: name1 
looooooooooooooooooooooooooooooooooooooooooooo
 1 A chapter
 ***********
 
-A paragraph
-   end paragraph
+A paragraph end paragraph
 
    a
 
@@ -3847,10 +3841,10 @@ Para.
 [index]
 * Menu:
 
-* ¡:                                     Top.                   (line 9)
-* ":                                     Top.                   (line 9)
-* @:                                     Top.                   (line 9)
-* in Top:                                Top.                   (line 9)
+* ¡:                                     Top.                   (line 8)
+* ":                                     Top.                   (line 8)
+* @:                                     Top.                   (line 8)
+* in Top:                                Top.                   (line 8)
 * index entry in appendix before para:   name1 
looooooooooooooooooooooooooooooooooooooooooooooooooooooooong.
                                                                 (line 6)
 * index entry looooooooooooooooooooooooooooooooooooooooooooooooooooooooong: 
name.
@@ -3864,15 +3858,15 @@ Para.
 * Menu:
 
 * a fun:                                 Top.                 (line  13)
-* after lines.:                          name.                (line  19)
-* after more than 100 lines:             name.                (line 168)
+* after lines.:                          name.                (line  18)
+* after more than 100 lines:             name.                (line 167)
 * function index entry:                  name.                (line   6)
 * I:                                     Top.                 (line  10)
 * index entry between indices:           name1 
looooooooooooooooooooooooooooooooooooooooooooooooooooooooong.
                                                               (line  24)
 * itemx fun:                             Top.                 (line  17)
 * machin:                                Top.                 (line  11)
-* other function:                        name.                (line   7)
+* other function:                        name.                (line   6)
 * second fun:                            Top.                 (line  16)
 
 A.1 appendixsec
@@ -3898,8 +3892,8 @@ B chapter end
 Tag Table:
 Node: Top27
 Node: name330
-Node: name1 looooooooooooooooooooooooooooooooooooooooooooooooooooooooong985
-Ref: a counting anchor3074
+Node: name1 looooooooooooooooooooooooooooooooooooooooooooooooooooooooong982
+Ref: a counting anchor3071
 
 End Tag Table
 
diff --git a/tp/t/results/invalid_nestings/tab_in_index.pl 
b/tp/t/results/invalid_nestings/tab_in_index.pl
index 8f003de1d3..63fedcc11e 100644
--- a/tp/t/results/invalid_nestings/tab_in_index.pl
+++ b/tp/t/results/invalid_nestings/tab_in_index.pl
@@ -85,52 +85,52 @@ $result_trees{'tab_in_index'} = {
                             {
                               'text' => 'aaa
 '
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
-                                {
-                                  'text' => 'in index entry '
-                                },
-                                {
-                                  'text' => ' ',
-                                  'type' => 'ignorable_spaces_after_command'
-                                },
+                              'args' => [
                                 {
-                                  'text' => 'in tab'
+                                  'contents' => [
+                                    {
+                                      'text' => 'in index entry '
+                                    },
+                                    {
+                                      'text' => ' ',
+                                      'type' => 
'ignorable_spaces_after_command'
+                                    },
+                                    {
+                                      'text' => 'in tab'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'vindex',
+                              'extra' => {
+                                'index_entry' => [
+                                  'vr',
+                                  1
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 3,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
                             }
                           ],
-                          'cmdname' => 'vindex',
-                          'extra' => {
-                            'index_entry' => [
-                              'vr',
-                              1
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 3,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
diff --git a/tp/t/results/itemize/inter_item_commands_in_enumerate.pl 
b/tp/t/results/itemize/inter_item_commands_in_enumerate.pl
index 0115776804..80dec636f4 100644
--- a/tp/t/results/itemize/inter_item_commands_in_enumerate.pl
+++ b/tp/t/results/itemize/inter_item_commands_in_enumerate.pl
@@ -676,46 +676,46 @@ $result_trees{'inter_item_commands_in_enumerate'} = {
                     {
                       'text' => 'Title
 '
-                    }
-                  ],
-                  'type' => 'paragraph'
-                },
-                {
-                  'args' => [
+                    },
                     {
-                      'contents' => [
+                      'args' => [
                         {
-                          'text' => 'cindex'
+                          'contents' => [
+                            {
+                              'text' => 'cindex'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
                         }
                       ],
+                      'cmdname' => 'cindex',
+                      'extra' => {
+                        'element_node' => {},
+                        'index_entry' => [
+                          'cp',
+                          4
+                        ]
+                      },
                       'info' => {
-                        'spaces_after_argument' => {
-                          'text' => '
-'
+                        'spaces_before_argument' => {
+                          'text' => ' '
                         }
                       },
-                      'type' => 'line_arg'
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 34,
+                        'macro' => ''
+                      },
+                      'type' => 'index_entry_command'
                     }
                   ],
-                  'cmdname' => 'cindex',
-                  'extra' => {
-                    'element_node' => {},
-                    'index_entry' => [
-                      'cp',
-                      4
-                    ]
-                  },
-                  'info' => {
-                    'spaces_before_argument' => {
-                      'text' => ' '
-                    }
-                  },
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 34,
-                    'macro' => ''
-                  },
-                  'type' => 'index_entry_command'
+                  'type' => 'paragraph'
                 }
               ],
               'type' => 'before_item'
@@ -1025,7 +1025,7 @@ $result_trees{'inter_item_commands_in_enumerate'} = {
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[3]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[7]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
-$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[9]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
+$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[9]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_enumerate'}{'contents'}[4]{'contents'}[11]{'contents'}[0]{'contents'}[3]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_enumerate'}{'contents'}[3];
diff --git a/tp/t/results/itemize/inter_item_commands_in_itemize.pl 
b/tp/t/results/itemize/inter_item_commands_in_itemize.pl
index 2d340c8ca9..184db6ad70 100644
--- a/tp/t/results/itemize/inter_item_commands_in_itemize.pl
+++ b/tp/t/results/itemize/inter_item_commands_in_itemize.pl
@@ -547,46 +547,46 @@ $result_trees{'inter_item_commands_in_itemize'} = {
                     {
                       'text' => 'T--ext before items.
 '
-                    }
-                  ],
-                  'type' => 'paragraph'
-                },
-                {
-                  'args' => [
+                    },
                     {
-                      'contents' => [
+                      'args' => [
                         {
-                          'text' => 'also a cindex in itemize'
+                          'contents' => [
+                            {
+                              'text' => 'also a cindex in itemize'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
                         }
                       ],
+                      'cmdname' => 'cindex',
+                      'extra' => {
+                        'element_node' => {},
+                        'index_entry' => [
+                          'cp',
+                          4
+                        ]
+                      },
                       'info' => {
-                        'spaces_after_argument' => {
-                          'text' => '
-'
+                        'spaces_before_argument' => {
+                          'text' => ' '
                         }
                       },
-                      'type' => 'line_arg'
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 23,
+                        'macro' => ''
+                      },
+                      'type' => 'index_entry_command'
                     }
                   ],
-                  'cmdname' => 'cindex',
-                  'extra' => {
-                    'element_node' => {},
-                    'index_entry' => [
-                      'cp',
-                      4
-                    ]
-                  },
-                  'info' => {
-                    'spaces_before_argument' => {
-                      'text' => ' '
-                    }
-                  },
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 23,
-                    'macro' => ''
-                  },
-                  'type' => 'index_entry_command'
+                  'type' => 'paragraph'
                 }
               ],
               'type' => 'before_item'
@@ -680,7 +680,7 @@ 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[1]{'e
 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[3]{'contents'}[0]{'contents'}[0]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_itemize'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[3]{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_itemize'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[3]{'extra'}{'command_as_argument'}
 = 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[3]{'args'}[0]{'contents'}[0];
-$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[5]{'contents'}[0]{'contents'}[2]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_itemize'}{'contents'}[3];
+$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[5]{'contents'}[0]{'contents'}[1]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'inter_item_commands_in_itemize'}{'contents'}[3];
 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[5]{'extra'}{'command_as_argument'}
 = 
$result_trees{'inter_item_commands_in_itemize'}{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'}[0];
 
 $result_texis{'inter_item_commands_in_itemize'} = '@node Top
diff --git a/tp/t/results/multitable/inter_item_commands_in_multitable.pl 
b/tp/t/results/multitable/inter_item_commands_in_multitable.pl
index dc0f5600a2..1f4376c600 100644
--- a/tp/t/results/multitable/inter_item_commands_in_multitable.pl
+++ b/tp/t/results/multitable/inter_item_commands_in_multitable.pl
@@ -453,45 +453,45 @@ $result_trees{'inter_item_commands_in_multitable'} = {
                             {
                               'text' => 'multitable tab 2
 '
-                            }
-                          ],
-                          'type' => 'paragraph'
-                        },
-                        {
-                          'args' => [
+                            },
                             {
-                              'contents' => [
+                              'args' => [
                                 {
-                                  'text' => 'index entry within multitable'
+                                  'contents' => [
+                                    {
+                                      'text' => 'index entry within multitable'
+                                    }
+                                  ],
+                                  'info' => {
+                                    'spaces_after_argument' => {
+                                      'text' => '
+'
+                                    }
+                                  },
+                                  'type' => 'line_arg'
                                 }
                               ],
+                              'cmdname' => 'cindex',
+                              'extra' => {
+                                'index_entry' => [
+                                  'cp',
+                                  2
+                                ]
+                              },
                               'info' => {
-                                'spaces_after_argument' => {
-                                  'text' => '
-'
+                                'spaces_before_argument' => {
+                                  'text' => ' '
                                 }
                               },
-                              'type' => 'line_arg'
+                              'source_info' => {
+                                'file_name' => '',
+                                'line_nr' => 17,
+                                'macro' => ''
+                              },
+                              'type' => 'index_entry_command'
                             }
                           ],
-                          'cmdname' => 'cindex',
-                          'extra' => {
-                            'index_entry' => [
-                              'cp',
-                              2
-                            ]
-                          },
-                          'info' => {
-                            'spaces_before_argument' => {
-                              'text' => ' '
-                            }
-                          },
-                          'source_info' => {
-                            'file_name' => '',
-                            'line_nr' => 17,
-                            'macro' => ''
-                          },
-                          'type' => 'index_entry_command'
+                          'type' => 'paragraph'
                         }
                       ],
                       'extra' => {
@@ -630,45 +630,45 @@ $result_trees{'inter_item_commands_in_multitable'} = {
                     {
                       'text' => 'Title
 '
-                    }
-                  ],
-                  'type' => 'paragraph'
-                },
-                {
-                  'args' => [
+                    },
                     {
-                      'contents' => [
+                      'args' => [
                         {
-                          'text' => 'cindex'
+                          'contents' => [
+                            {
+                              'text' => 'cindex'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
                         }
                       ],
+                      'cmdname' => 'cindex',
+                      'extra' => {
+                        'index_entry' => [
+                          'cp',
+                          3
+                        ]
+                      },
                       'info' => {
-                        'spaces_after_argument' => {
-                          'text' => '
-'
+                        'spaces_before_argument' => {
+                          'text' => ' '
                         }
                       },
-                      'type' => 'line_arg'
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 23,
+                        'macro' => ''
+                      },
+                      'type' => 'index_entry_command'
                     }
                   ],
-                  'cmdname' => 'cindex',
-                  'extra' => {
-                    'index_entry' => [
-                      'cp',
-                      3
-                    ]
-                  },
-                  'info' => {
-                    'spaces_before_argument' => {
-                      'text' => ' '
-                    }
-                  },
-                  'source_info' => {
-                    'file_name' => '',
-                    'line_nr' => 23,
-                    'macro' => ''
-                  },
-                  'type' => 'index_entry_command'
+                  'type' => 'paragraph'
                 }
               ],
               'type' => 'before_item'
@@ -920,14 +920,14 @@ 
$result_converted{'xml'}->{'inter_item_commands_in_multitable'} = '<multitable s
 </para></entry></row></thead><tbody><row><entry command="item"> 
<para>mu&textndash;ltitable item </para></entry><entry command="tab"> 
<para>multitable tab
 <!-- c comment in multitable -->
 </para></entry></row><row><entry command="item"> <para>mu&textndash;ltitable 
item 2 </para></entry><entry command="tab"> <para>multitable tab 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="2">index 
entry within multitable</indexterm></cindex>
-</entry></row><row><entry command="item"> <para>lone mu&textndash;ltitable item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="2">index entry 
within multitable</indexterm></cindex>
+</para></entry></row><row><entry command="item"> <para>lone 
mu&textndash;ltitable item
 </para></entry></row></tbody></multitable>
 
 <multitable spaces=" " endspaces=" "><columnprototypes><columnprototype 
bracketed="on">thing</columnprototype></columnprototypes>
 <beforefirstitem><para>Title
-</para><cindex index="cp" spaces=" "><indexterm index="cp" 
number="3">cindex</indexterm></cindex>
-</beforefirstitem><tbody><row><entry command="item"> <para>thing
+<cindex index="cp" spaces=" "><indexterm index="cp" 
number="3">cindex</indexterm></cindex>
+</para></beforefirstitem><tbody><row><entry command="item"> <para>thing
 </para></entry></row></tbody></multitable>
 
 ';
diff --git a/tp/t/results/plaintext_tests/at_commands_glued_in_paragraph.pl 
b/tp/t/results/plaintext_tests/at_commands_glued_in_paragraph.pl
index bff6f124a7..994b8f4399 100644
--- a/tp/t/results/plaintext_tests/at_commands_glued_in_paragraph.pl
+++ b/tp/t/results/plaintext_tests/at_commands_glued_in_paragraph.pl
@@ -369,45 +369,45 @@ $result_trees{'at_commands_glued_in_paragraph'} = {
             },
             {
               'text' => 'index'
-            }
-          ],
-          'type' => 'paragraph'
-        },
-        {
-          'args' => [
+            },
             {
-              'contents' => [
+              'args' => [
                 {
-                  'text' => 'index'
+                  'contents' => [
+                    {
+                      'text' => 'index'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
                 }
               ],
+              'cmdname' => 'cindex',
+              'extra' => {
+                'index_entry' => [
+                  'cp',
+                  1
+                ]
+              },
               'info' => {
-                'spaces_after_argument' => {
-                  'text' => '
-'
+                'spaces_before_argument' => {
+                  'text' => ' '
                 }
               },
-              'type' => 'line_arg'
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 14,
+                'macro' => ''
+              },
+              'type' => 'index_entry_command'
             }
           ],
-          'cmdname' => 'cindex',
-          'extra' => {
-            'index_entry' => [
-              'cp',
-              1
-            ]
-          },
-          'info' => {
-            'spaces_before_argument' => {
-              'text' => ' '
-            }
-          },
-          'source_info' => {
-            'file_name' => '',
-            'line_nr' => 14,
-            'macro' => ''
-          },
-          'type' => 'index_entry_command'
+          'type' => 'paragraph'
         }
       ],
       'type' => 'before_node_section'
diff --git a/tp/tests/coverage/res_parser/formatting_chm/chapter.html 
b/tp/tests/coverage/res_parser/formatting_chm/chapter.html
index 1d4393c06f..d0ff083e40 100644
--- a/tp/tests/coverage/res_parser/formatting_chm/chapter.html
+++ b/tp/tests/coverage/res_parser/formatting_chm/chapter.html
@@ -4999,8 +4999,8 @@ Invalid use of @':
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/coverage/res_parser/formatting_docbook/formatting.xml 
b/tp/tests/coverage/res_parser/formatting_docbook/formatting.xml
index 42b22c99d7..b87e9d5783 100644
--- a/tp/tests/coverage/res_parser/formatting_docbook/formatting.xml
+++ b/tp/tests/coverage/res_parser/formatting_docbook/formatting.xml
@@ -385,8 +385,8 @@ error&#8594; &#8614; &#8722; &#8867; &#8658;
 </para></entry></row></thead><tbody><row><entry><para>mu&#8211;ltitable item 
</para></entry><entry><para>multitable tab
 <!-- comment in multitable -->
 </para></entry></row><row><entry><para>mu&#8211;ltitable item 2 
</para></entry><entry><para>multitable tab 2
-</para><indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
-</entry></row><row><entry><para>lone mu&#8211;ltitable item
+<indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
+</para></entry></row><row><entry><para>lone mu&#8211;ltitable item
 </para></entry></row></tbody></tgroup></informaltable>
 <informaltable><tgroup cols="2"><colspec colwidth="4*"></colspec><colspec 
colwidth="6*"></colspec><tbody><row><entry><para>truc 
</para></entry><entry><para>bidule
 </para></entry></row></tbody></tgroup></informaltable>
@@ -1314,8 +1314,8 @@ error&#8594; &#8614; &#8722; &#8867; &#8658;
 </para></entry></row></thead><tbody><row><entry><para>mu&#8211;ltitable item 
</para></entry><entry><para>multitable tab
 <!-- comment in multitable -->
 </para></entry></row><row><entry><para>mu&#8211;ltitable item 2 
</para></entry><entry><para>multitable tab 2
-</para><indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
-</entry></row><row><entry><para>lone mu&#8211;ltitable item
+<indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
+</para></entry></row><row><entry><para>lone mu&#8211;ltitable item
 </para></entry></row></tbody></tgroup></informaltable>
 <informaltable><tgroup cols="2"><colspec colwidth="4*"></colspec><colspec 
colwidth="6*"></colspec><tbody><row><entry><para>truc 
</para></entry><entry><para>bidule
 </para></entry></row></tbody></tgroup></informaltable>
@@ -2230,8 +2230,8 @@ error&#8594; &#8614; &#8722; &#8867; &#8658;
 </para></entry></row></thead><tbody><row><entry><para>mu&#8211;ltitable item 
</para></entry><entry><para>multitable tab
 <!-- comment in multitable -->
 </para></entry></row><row><entry><para>mu&#8211;ltitable item 2 
</para></entry><entry><para>multitable tab 2
-</para><indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
-</entry></row><row><entry><para>lone mu&#8211;ltitable item
+<indexterm role="cp"><primary>index entry within 
multitable</primary></indexterm>
+</para></entry></row><row><entry><para>lone mu&#8211;ltitable item
 </para></entry></row></tbody></tgroup></informaltable>
 <informaltable><tgroup cols="2"><colspec colwidth="4*"></colspec><colspec 
colwidth="6*"></colspec><tbody><row><entry><para>truc 
</para></entry><entry><para>bidule
 </para></entry></row></tbody></tgroup></informaltable>
@@ -3725,8 +3725,8 @@ Various deff lines
 
 
 <para>Text<footnote><para>in footnote
-</para><indexterm role="cp"><primary>index entry in 
footnote</primary></indexterm>
-
+<indexterm role="cp"><primary>index entry in footnote</primary></indexterm>
+</para>
 <para>Blah
 </para>
 <para>Blih
diff --git 
a/tp/tests/coverage/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
 
b/tp/tests/coverage/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
index e217e4a9e8..3bc1b4a5d3 100644
--- 
a/tp/tests/coverage/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
+++ 
b/tp/tests/coverage/res_parser/formatting_epub/formatting_epub_package/EPUB/xhtml/chapter.xhtml
@@ -5018,8 +5018,8 @@ Invalid use of @':
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/coverage/res_parser/formatting_html32/formatting.html 
b/tp/tests/coverage/res_parser/formatting_html32/formatting.html
index 346ad01f47..e26f42546f 100644
--- a/tp/tests/coverage/res_parser/formatting_html32/formatting.html
+++ b/tp/tests/coverage/res_parser/formatting_html32/formatting.html
@@ -7806,8 +7806,8 @@ Previous: <a href="#chapter" rel="prev">chapter</a>, Up: 
<a href="#Top" rel="up"
 <p>in footnote2</p>
 <h5><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a name="index-index-entry-in-footnote"></a>
-
+<a name="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git 
a/tp/tests/coverage/res_parser/formatting_html_no_split/formatting.html 
b/tp/tests/coverage/res_parser/formatting_html_no_split/formatting.html
index 02dc8fabb0..e51c59cbdb 100644
--- a/tp/tests/coverage/res_parser/formatting_html_no_split/formatting.html
+++ b/tp/tests/coverage/res_parser/formatting_html_no_split/formatting.html
@@ -5661,8 +5661,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(7)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/coverage/res_parser/formatting_info/formatting.info 
b/tp/tests/coverage/res_parser/formatting_info/formatting.info
index 66560adfb4..7fc8e835fd 100644
--- a/tp/tests/coverage/res_parser/formatting_info/formatting.info
+++ b/tp/tests/coverage/res_parser/formatting_info/formatting.info
@@ -3042,8 +3042,8 @@ aaa"]
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
@@ -3414,15 +3414,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1325)
 * index entry between item and itemx <4>: chapter.           (line 2015)
 * index entry between item and itemx <5>: chapter.           (line 2177)
-* index entry in footnote:               chapter.            (line 2582)
+* index entry in footnote:               chapter.            (line 2581)
 * index entry within deffn:              chapter.            (line  302)
 * index entry within deffn <1>:          chapter.            (line  983)
 * index entry within deffn <2>:          chapter.            (line 1800)
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
diff --git a/tp/tests/coverage/res_parser/formatting_plaintext/formatting.txt 
b/tp/tests/coverage/res_parser/formatting_plaintext/formatting.txt
index b0101631dc..0193d16802 100644
--- a/tp/tests/coverage/res_parser/formatting_plaintext/formatting.txt
+++ b/tp/tests/coverage/res_parser/formatting_plaintext/formatting.txt
@@ -2328,8 +2328,8 @@ aaa
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
@@ -2660,15 +2660,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1325)
 * index entry between item and itemx <4>: chapter.           (line 2015)
 * index entry between item and itemx <5>: chapter.           (line 2177)
-* index entry in footnote:               chapter.            (line 2569)
+* index entry in footnote:               chapter.            (line 2568)
 * index entry within deffn:              chapter.            (line  302)
 * index entry within deffn <1>:          chapter.            (line  983)
 * index entry within deffn <2>:          chapter.            (line 1800)
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
diff --git a/tp/tests/coverage/res_parser/formatting_xhtml/formatting.html 
b/tp/tests/coverage/res_parser/formatting_xhtml/formatting.html
index 9d93425c28..1a7f3b6f52 100644
--- a/tp/tests/coverage/res_parser/formatting_xhtml/formatting.html
+++ b/tp/tests/coverage/res_parser/formatting_xhtml/formatting.html
@@ -7948,8 +7948,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/coverage/res_parser/formatting_xml/formatting.xml 
b/tp/tests/coverage/res_parser/formatting_xml/formatting.xml
index 9ea7f278b7..fde9aad86d 100644
--- a/tp/tests/coverage/res_parser/formatting_xml/formatting.xml
+++ b/tp/tests/coverage/res_parser/formatting_xml/formatting.xml
@@ -1684,8 +1684,8 @@ quotation
 </para></entry></row></thead><tbody><row><entry command="item"> 
<para>mu&textndash;ltitable item </para></entry><entry command="tab"> 
<para>multitable tab
 <!-- c comment in multitable -->
 </para></entry></row><row><entry command="item"> <para>mu&textndash;ltitable 
item 2 </para></entry><entry command="tab"> <para>multitable tab 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="4">index 
entry within multitable</indexterm></cindex>
-</entry></row><row><entry command="item"> <para>lone mu&textndash;ltitable item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="4">index entry 
within multitable</indexterm></cindex>
+</para></entry></row><row><entry command="item"> <para>lone 
mu&textndash;ltitable item
 </para></entry></row></tbody></multitable>
 
 <multitable spaces=" " endspaces=" "><columnprototypes><columnprototype 
bracketed="on">truc</columnprototype> <columnprototype 
bracketed="on">bidule</columnprototype></columnprototypes>
@@ -2843,8 +2843,8 @@ quotation
 </para></entry></row></thead><tbody><row><entry command="item"> 
<para>mu&textndash;ltitable item </para></entry><entry command="tab"> 
<para>multitable tab
 <!-- c comment in multitable -->
 </para></entry></row><row><entry command="item"> <para>mu&textndash;ltitable 
item 2 </para></entry><entry command="tab"> <para>multitable tab 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="11">index 
entry within multitable</indexterm></cindex>
-</entry></row><row><entry command="item"> <para>lone mu&textndash;ltitable item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="11">index entry 
within multitable</indexterm></cindex>
+</para></entry></row><row><entry command="item"> <para>lone 
mu&textndash;ltitable item
 </para></entry></row></tbody></multitable>
 
 <multitable spaces=" " endspaces=" "><columnprototypes><columnprototype 
bracketed="on">truc</columnprototype> <columnprototype 
bracketed="on">bidule</columnprototype></columnprototypes>
@@ -4042,8 +4042,8 @@ quotation
 </para></entry></row></thead><tbody><row><entry command="item"> 
<para>mu&textndash;ltitable item </para></entry><entry command="tab"> 
<para>multitable tab
 <!-- c comment in multitable -->
 </para></entry></row><row><entry command="item"> <para>mu&textndash;ltitable 
item 2 </para></entry><entry command="tab"> <para>multitable tab 2
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="18">index 
entry within multitable</indexterm></cindex>
-</entry></row><row><entry command="item"> <para>lone mu&textndash;ltitable item
+<cindex index="cp" spaces=" "><indexterm index="cp" number="18">index entry 
within multitable</indexterm></cindex>
+</para></entry></row><row><entry command="item"> <para>lone 
mu&textndash;ltitable item
 </para></entry></row></tbody></multitable>
 
 <multitable spaces=" " endspaces=" "><columnprototypes><columnprototype 
bracketed="on">truc</columnprototype> <columnprototype 
bracketed="on">bidule</columnprototype></columnprototypes>
@@ -5923,8 +5923,8 @@ Various deff lines
 <syncodeindex spaces=" " from="vr" to="cp" line="vr cp"></syncodeindex>
 
 <para>Text<footnote><para>in footnote
-</para><cindex index="cp" spaces=" "><indexterm index="cp" number="42">index 
entry in footnote</indexterm></cindex>
-
+<cindex index="cp" spaces=" "><indexterm index="cp" number="42">index entry in 
footnote</indexterm></cindex>
+</para>
 <para>Blah
 </para>
 <para>Blih
diff --git 
a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html 
b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
index cc7e9dbd3c..3ff15653fd 100644
--- a/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_enable_encoding/formatting.html
@@ -7983,8 +7983,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/formatting_fot.xhtml
 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/formatting_fot.xhtml
index 3c0b16fc3c..437a99a303 100644
--- 
a/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/formatting_fot.xhtml
+++ 
b/tp/tests/layout/res_parser/formatting_epub_nodes/formatting_epub_package/EPUB/xhtml/formatting_fot.xhtml
@@ -893,8 +893,8 @@ g-roupe
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" 
href="chapter.xhtml#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_exotic/chapter.html 
b/tp/tests/layout/res_parser/formatting_exotic/chapter.html
index 5bd155e8d2..932e3656b1 100644
--- a/tp/tests/layout/res_parser/formatting_exotic/chapter.html
+++ b/tp/tests/layout/res_parser/formatting_exotic/chapter.html
@@ -5009,8 +5009,8 @@ Invalid use of @':
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(7)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_fr/formatting.html 
b/tp/tests/layout/res_parser/formatting_fr/formatting.html
index cd05851a7b..acb74ce19c 100644
--- a/tp/tests/layout/res_parser/formatting_fr/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr/formatting.html
@@ -7937,8 +7937,8 @@ Menu comment
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html 
b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
index 1fbd0f93d0..29fcebe3e0 100644
--- a/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_fr_icons/formatting.html
@@ -7937,8 +7937,8 @@ Menu comment
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_fr_info/formatting.info 
b/tp/tests/layout/res_parser/formatting_fr_info/formatting.info
index 5e4ee8f9f2..ce35184f7a 100644
--- a/tp/tests/layout/res_parser/formatting_fr_info/formatting.info
+++ b/tp/tests/layout/res_parser/formatting_fr_info/formatting.info
@@ -3042,8 +3042,8 @@ aaa"]
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
@@ -3414,15 +3414,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1325)
 * index entry between item and itemx <4>: chapter.           (line 2015)
 * index entry between item and itemx <5>: chapter.           (line 2177)
-* index entry in footnote:               chapter.            (line 2582)
+* index entry in footnote:               chapter.            (line 2581)
 * index entry within deffn:              chapter.            (line  302)
 * index entry within deffn <1>:          chapter.            (line  983)
 * index entry within deffn <2>:          chapter.            (line 1800)
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
diff --git 
a/tp/tests/layout/res_parser/formatting_info_ascii_punctuation/formatting.info 
b/tp/tests/layout/res_parser/formatting_info_ascii_punctuation/formatting.info
index 064f0439ab..ac7fcfccd9 100644
--- 
a/tp/tests/layout/res_parser/formatting_info_ascii_punctuation/formatting.info
+++ 
b/tp/tests/layout/res_parser/formatting_info_ascii_punctuation/formatting.info
@@ -3042,8 +3042,8 @@ aaa"]
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
@@ -3414,15 +3414,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1325)
 * index entry between item and itemx <4>: chapter.           (line 2015)
 * index entry between item and itemx <5>: chapter.           (line 2177)
-* index entry in footnote:               chapter.            (line 2582)
+* index entry in footnote:               chapter.            (line 2581)
 * index entry within deffn:              chapter.            (line  302)
 * index entry within deffn <1>:          chapter.            (line  983)
 * index entry within deffn <2>:          chapter.            (line 1800)
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
diff --git 
a/tp/tests/layout/res_parser/formatting_info_disable_encoding/formatting.info 
b/tp/tests/layout/res_parser/formatting_info_disable_encoding/formatting.info
index 362833a161..176b6baed5 100644
--- 
a/tp/tests/layout/res_parser/formatting_info_disable_encoding/formatting.info
+++ 
b/tp/tests/layout/res_parser/formatting_info_disable_encoding/formatting.info
@@ -3045,8 +3045,8 @@ aaa"]
 * index entry within itemize:            chapter.            (line  214)
 * index entry within itemize <1>:        chapter.            (line  896)
 * index entry within itemize <2>:        chapter.            (line 1713)
-* index entry within multitable:         chapter.            (line  237)
-* index entry within multitable <1>:     chapter.            (line  919)
+* index entry within multitable:         chapter.            (line  236)
+* index entry within multitable <1>:     chapter.            (line  918)
 * index entry within multitable <2>:     chapter.            (line 1736)
 * t-ruc:                                 chapter.            (line 2238)
 * T-ruc:                                 chapter.            (line 2238)
@@ -3417,15 +3417,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1327)
 * index entry between item and itemx <4>: chapter.           (line 2017)
 * index entry between item and itemx <5>: chapter.           (line 2179)
-* index entry in footnote:               chapter.            (line 2584)
+* index entry in footnote:               chapter.            (line 2583)
 * index entry within deffn:              chapter.            (line  303)
 * index entry within deffn <1>:          chapter.            (line  985)
 * index entry within deffn <2>:          chapter.            (line 1802)
 * index entry within itemize:            chapter.            (line  214)
 * index entry within itemize <1>:        chapter.            (line  896)
 * index entry within itemize <2>:        chapter.            (line 1713)
-* index entry within multitable:         chapter.            (line  237)
-* index entry within multitable <1>:     chapter.            (line  919)
+* index entry within multitable:         chapter.            (line  236)
+* index entry within multitable <1>:     chapter.            (line  918)
 * index entry within multitable <2>:     chapter.            (line 1736)
 * t-ruc:                                 chapter.            (line 2238)
 * T-ruc:                                 chapter.            (line 2238)
diff --git a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html 
b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
index f7495f197e..e530cdbc16 100644
--- a/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_inline_css/formatting.html
@@ -7951,8 +7951,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html 
b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
index 5853f88830..c981d3fd1a 100644
--- a/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_mathjax/formatting.html
@@ -7859,8 +7859,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git 
a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html 
b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
index 6cc9032fd6..b7dae4644e 100644
--- a/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_numerical_entities/formatting.html
@@ -7983,8 +7983,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git 
a/tp/tests/layout/res_parser/formatting_plaintext_ascii_punctuation/formatting.txt
 
b/tp/tests/layout/res_parser/formatting_plaintext_ascii_punctuation/formatting.txt
index dbf42d5d4c..22a78450f6 100644
--- 
a/tp/tests/layout/res_parser/formatting_plaintext_ascii_punctuation/formatting.txt
+++ 
b/tp/tests/layout/res_parser/formatting_plaintext_ascii_punctuation/formatting.txt
@@ -2328,8 +2328,8 @@ aaa
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
@@ -2660,15 +2660,15 @@ chapter 2
 * index entry between item and itemx <3>: chapter.           (line 1325)
 * index entry between item and itemx <4>: chapter.           (line 2015)
 * index entry between item and itemx <5>: chapter.           (line 2177)
-* index entry in footnote:               chapter.            (line 2569)
+* index entry in footnote:               chapter.            (line 2568)
 * index entry within deffn:              chapter.            (line  302)
 * index entry within deffn <1>:          chapter.            (line  983)
 * index entry within deffn <2>:          chapter.            (line 1800)
 * index entry within itemize:            chapter.            (line  213)
 * index entry within itemize <1>:        chapter.            (line  894)
 * index entry within itemize <2>:        chapter.            (line 1711)
-* index entry within multitable:         chapter.            (line  236)
-* index entry within multitable <1>:     chapter.            (line  917)
+* index entry within multitable:         chapter.            (line  235)
+* index entry within multitable <1>:     chapter.            (line  916)
 * index entry within multitable <2>:     chapter.            (line 1734)
 * t-ruc:                                 chapter.            (line 2236)
 * T-ruc:                                 chapter.            (line 2236)
diff --git 
a/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html 
b/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
index 6ed60eac68..8cd31811bd 100644
--- a/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_sort_element_counts/formatting.html
@@ -5661,8 +5661,8 @@ Prev: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>,  Up : <a href="#T
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(7)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_texi2html/formatting.html 
b/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
index fd4f05bef2..1f98d09347 100644
--- a/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_texi2html/formatting.html
@@ -7937,8 +7937,8 @@ Menu comment
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git 
a/tp/tests/layout/res_parser/formatting_texi2html_nodes/formatting_fot.html 
b/tp/tests/layout/res_parser/formatting_texi2html_nodes/formatting_fot.html
index e84fc1cb48..6fd99bb6b9 100644
--- a/tp/tests/layout/res_parser/formatting_texi2html_nodes/formatting_fot.html
+++ b/tp/tests/layout/res_parser/formatting_texi2html_nodes/formatting_fot.html
@@ -899,8 +899,8 @@ span.program-in-footer {font-size: smaller}
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" 
href="chapter.html#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html 
b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
index 1e9a41514b..a93d01a06b 100644
--- a/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
+++ b/tp/tests/layout/res_parser/formatting_weird_quotes/formatting.html
@@ -7983,8 +7983,8 @@ Previous: <a href="#chapter" accesskey="p" 
rel="prev">chapter</a>, Up: <a href="
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(11)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih
diff --git a/tp/tests/tex_html/res_parser/formatting_singular/sing_fot.htm 
b/tp/tests/tex_html/res_parser/formatting_singular/sing_fot.htm
index 3582bd89c6..dfd9845642 100644
--- a/tp/tests/tex_html/res_parser/formatting_singular/sing_fot.htm
+++ b/tp/tests/tex_html/res_parser/formatting_singular/sing_fot.htm
@@ -906,8 +906,8 @@ g-roupe
 <p>in footnote2</p>
 <h5 class="footnote-body-heading"><a id="FOOT9" 
href="chapter.html#DOCF9">(7)</a></h5>
 <p>in footnote
-</p><a class="index-entry-id" id="index-index-entry-in-footnote"></a>
-
+<a class="index-entry-id" id="index-index-entry-in-footnote"></a>
+</p>
 <p>Blah
 </p>
 <p>Blih



reply via email to

[Prev in Thread] Current Thread [Next in Thread]