You can set the customization variable CONTENTS_OUTPUT_LOCATION
to determine where the table of contents and short table of content
are output in the document (see HTML Output Structure Customization in Texinfo):
The tables of contents are output at the end of the @top
section, to have the main location for navigation in the whole document
early on. This is in line with FORMAT_MENU
set to ‘sectiontoc’
with sectioning command being used in HTML for navigation rather
than menus. This is the default.
The tables of
content are output where the corresponding @-command, for example
@contents
, is set. This behavior is consistent with
texi2dvi
.
The tables of contents are output in separate output units, either at
the end of the document if the output is unsplit or in separate files if not.
This makes sense when menus are used for navigation with FORMAT_MENU
set
to ‘menu’.
The tables of contents are merged into the title material, which in turn is not output by default; see HTML Title Page Customization.
You can set other customization variables to modify table of contents links formatting (see File Names and Links Customization for HTML in Texinfo) and change the HTML code inserted before and after the tables of contents (see Customization of HTML Code Inserted in Texinfo).
Finally, the following function reference provides even more control over the table of contents and short table of contents formatting reference:
$toc_result
format_contents ($converter, $command_name, \%element, $filename)
¶$command_name is the @-command name without leading @, should be
‘contents’, ‘shortcontents’ or ‘summarycontents’.
\%element is optional. It corresponds to the $command_name Texinfo
tree element, but it is only set if format_contents
is called from a
Texinfo tree element conversion, and not as a special element body formatting.
$filename is optional and should correspond to the filename where the
formatting happens, for links.
In the default function, structuring information is used
to format the table of contents (see Converter General Information),
and command_contents_href
and command_href
(see Target Tree Element Link)
are used for links. If $filename is unset, the current file name
is used, using $converter->current_filename()
.
Return formatted table of contents or short table of contents.
If contents are in a separate output unit (see Output Units), the
default contents and shortcontents special element body formatting function
calls format_contents
(see Special Unit Body Formatting Functions). Otherwise, format_contents
is called in the conversion
of heading @-command, in title page formatting, and in @contents
conversion function, depending on the CONTENTS_OUTPUT_LOCATION
value.
To get id and link href of sectioning commands in table of contents
and short table of contents, use command_contents_target
and
command_contents_href
:
$target =
$converter->command_contents_target (\%sectioning_element, $contents_or_shortcontents)
¶Returns the id for the location of \%sectioning_element sectioning element in the table of contents, if $contents_or_shortcontents is ‘contents’, or in the short table of contents, if $contents_or_shortcontents is set to ‘shortcontents’ or ‘summarycontents’.
$href =
$converter->command_contents_href (\%sectioning_element, $contents_or_shortcontents, $source_filename)
¶Return string for linking to the \%sectioning_element sectioning element
location in the table of contents, if $contents_or_shortcontents is
‘contents’ or in the short table of contents, if
$contents_or_shortcontents is set to ‘shortcontents’ or
‘summarycontents’. $source_filename is the file the link comes
from. If not set, the current file name is used.
Returns undef
if no string is found or the string is empty.