[l2h] Need symbolic anchors for index link targets

Julius Smith jos@w3k.org
Mon, 18 Jun 2001 15:24:50 -0700

I am using my latex2html-generated Index.html file to create a "URL 
database" pointing into my various online documents.  (I am using 
l2h-99.2beta6.)  My problem is that the index link targets use 
automatically generated intra-page anchors (a number generated by 
++$global{'max_id'}) instead of symbolic anchors provided by the \label{} 
command.  For example, in Index.html, I get

	<A HREF="Delay_Effects.html#3358"><B>Delay Effects</B></A>

instead of

	<A HREF="Delay_Effects.html#delayeffects"><B>Delay Effects</B></A>

where "delayeffects" comes from saying, in the source,

	\label{delayeffects}\index{delay effects}

I need these URLs to be symbolic so they will survive document updates and 
recompilations.  (I want to "publish" the URL database.)

I found the ability to use \label{}s inside an \index{} entry, e.g.,

	\index{\protect\label{delayeffects}delay effects}

but this generates a symbolic name for the index entry itself, not its target.

Question: Have I overlooked a way to achieve the desired result?

Suggestion: If not, perhaps it would be feasible for 
&make_real_index_entry() to use a pre-existing anchor name for the same 
spot, when it exists, instead of creating a new unique anchor 
name?  Alternatively, perhaps makeidx.perl, or a later post-processing 
pass, could scan the final output HTML to detect multiple ANCHORs for the 
same spot, delete any l2h-generated anchors (indicated by the prefix 
'tex2html', e.g.), and fix up all references in Index.html et al.?

Hmmm, since I never create \label{}s of the form "name#<number>", I can 
write a post-processing perl script to do this myself based on the form of 
the URL in the redundant ANCHOR.  I'll do this if I don't hear any better 
ideas.  If anybody wants a copy of the script, just send me email.