On Tue, Dec 21, 2021 at 09:28:45PM +0000, Gavin Smith wrote:
> On Mon, Oct 18, 2021 at 10:35:17AM +0200, Benno Schulenberg wrote:
> > > By default a list of chapters isn't output at the start, as it would
> > > be repetition from the table of contents. However, if
> > > "-c CONTENTS_OUTPUT_LOCATION=inline" is given as an option to texi2any,
> > > I see that it is a problem that there is no initial list of chapters.
> >
> > Indeed.
>
> I've changed this in commit d94128ef20. Now a list of chapters will be output
> with -c CONTENTS_OUTPUT_LOCATION=inline.
I think that it is wrong. Indeed, the principle of
CONTENTS_OUTPUT_LOCATION=inline is to have the table of contents
output where the @-command @contents is. If the user uses
CONTENTS_OUTPUT_LOCATION=inline it means that she wants the table of
contents to appear where @contents here, not at the beginning as it is
the meaning of CONTENTS_OUTPUT_LOCATION=after_top.
To me, if anything needs to change, it should only be the documentation.
> > Also, using those options and an @contents command, the menu is flush
> > against the
> > left margin. But without the options and without @contents, the menu is
> > slightly
> > indented. The latter looks much better.
> >
> >
> > > You could add @shortcontents at the start of the document to get a list
> > > of chapters. Do you think that would solve the problem?
> >
> > It would. However, the links don't work: clicking them does not lead
> > anywhere.
> >
> > :|
>
> Haven't looked into this yet.
>
> > (Also, I don't want the loud "Short Table of Contents" header. Is there a
> > way
> > to suppress that? I like that the list is numbered instead of bulleted,
> > but do
> > not want the header.)
Removing completly the header can be done with the init file I attach.
Changing the formatting would be more complicated, it would probably
require setting up a new 'format_...' like
format_contents_inline_element, and redefining it.
--
Pat
use strict;
sub my_set_shortcontents_header
{
my $self = shift;
my $special_elements_heading = $self->get_conf('SPECIAL_ELEMENTS_HEADING');
$special_elements_heading->{'Overview'} = {};
# other example
#$special_elements_heading->{'Overview'} = $self->gdt('@slanted{heeadeer}');
}
texinfo_register_handler('structure', \&my_set_shortcontents_header);
# if there is a @documentlanguage, the string will be changed
# change it back again here
sub my_set_shortcontents_header_translation
{
my $self = shift;
my $cmdname = shift;
my $command = shift;
my $result = &{$self->default_commands_conversion($cmdname)}($self,
$cmdname, $command, undef);
my $special_elements_heading = $self->get_conf('SPECIAL_ELEMENTS_HEADING');
$special_elements_heading->{'Overview'} = {};
# other example
#$special_elements_heading->{'Overview'} = $self->gdt('@slanted{heeadeer}');
return $result;
}
texinfo_register_command_formatting('documentlanguage', \&my_set_shortcontents_header_translation);
1;