[l2h] Re: Info about custom_title_hook
Ross Moore
ross@ics.mq.edu.au
Wed, 13 Nov 2002 23:51:12 +1100 (EST)
[Charset ISO-8859-1 unsupported, filtering to ASCII...]
> Hello,
>
> I am currently working on a multimedia project for teaching numerical
> methods to engineers with the Web.
> I use latex to generate texts and latex2html for html translation.
>
> I need to replace the usual names 'node1.html, ...' by the number of the
> section concerned.
>
> For this, I first use the following instructions :
>
> \renewcommand{\thesection}{\Alph{section}}
> \renewcommand{\thesubsection}{\thesection.\Alph{subsection}}
> \renewcommand{\thesubsubsection}{\thesubsection.\Alph{subsubsection}}
>
> in order to obtain an alphabetical section title.
>
> For example, it will give section titles of the form 'AAAB, AAAC, ...'
>
> The idea is to finally obtain files named 'AAAB.html, AAAC.html, ...'
> replacing 'node1.html, node2.html ...'
>
> I know that we may generalize this approach in using the perl program
> 'custom_title_hook'.
This should come pretty close to what you want.
The logic is easy enough once you realise that the level-numbering
is available, independent from section-names.
sub custom_title_hook {
my ($i,$A,$return) = (0,'0',''); #initialise variables
my @sects = split (/_/, $packed_curr_sec_id); #get level numbers
while ($A eq 0) { $A = shift @sects }; #discard leading 0s
while ($i < 4) {
$return .= &fAlph($A); #convert number to letter
$A = shift @sects; #get next level
++$i; #increment counter
}
$return #should be 4 letters
}
This hasn't been tested.
I hope it works OK.
Hope this helps,
Ross Moore
> The problem is that I don't know how to write this subroutine in Perl, I
> have no experience in Perl language.
>
> If this doesn't take to much time for you, would you be able to send me
> the subroutine?
>
> It will give me so much help because the number of sections is about 300.
>
> Thanks a lot in advance and for helping non developers to use latex2html.
>
> Sincerely yours
>
> E.L.
> --
> Emmanuel Lefran_ois - Universit_ de Technologie de Compi_gne
> Laboratoire Roberval, UMR6066 UTC-CNRS D_partement GSM
> B.P. 20529, 60205 Compi_gne Cedex, France
> Tel: +33 (0)3 44 23 49 88, Fax: +33 (0)3 44 23 46 89
> http://www.utc.fr/~elefra02
>