[l2h] Index entries include trailing format specifications such as '|textbf'

Ross Moore ross@ics.mq.edu.au
Mon, 29 Oct 2001 11:23:51 +1100 (EST)


Hello Julius,

you wrote:
> I discovered that index entries including a format specification, such as
> 
> 	keyword\index{keyword|textbf}

Does this work in LaTeX if \usepackage{makeidx} is *not* loaded ?

 
> produce keys in the HTML index including the format spec, i.e., 
> "keyword|textbf" appears in the final Index.html entries generated by 
> latex2html.  This problem does not appear to occur when the makeidx package 
> is used (invoking styles/makeidx.perl).  Below is a one-line fix that works 

Yes; all of the makeidx syntax has been implemented in  makeidx.perl .
(All, that is, assuming that there is no index-style file which
redefines the meanings of  @ ! | or " to other symbols.)

Thus the definition for  do_cmd_index  in  latex2html  is just a very basic,
no-frills version.  To get the full-featured interpretation of \index
you are expected to  \usepackage{makeidx} ...


> in all cases I have tested:
> 
> *** latex2html~	Fri Sep 28 14:17:52 2001
> --- latex2html	Sun Oct 28 12:30:44 2001
> ***************
> *** 8322,8327 ****
> --- 8322,8328 ----
>    	}
>    	$str = $current[$#current];
>    	$str =~ s/\#\#\#\d+$//o; # Remove the unique id's
> + 	$str =~ s/\|(.*)$//; # Remove any trailing macro wrapper spec (NEW)
>    	$index .= $index{$key} .
>    	    # If it's the same string don't start a new line
>    	    (&index_key_eq(join('',@current), join('',@previous)) ?
> --------------------
> 
> Note that page 154 of Lamport (1994) gives some "fine print" about the 


 ... That section of Lamport refers to use of MakeIndex and the 'makeidx'
package.  The first instruction on p.150 is to load this package.


> behavior of '|' in an index entry.  E.g., it can be quoted by a preceding 
> `"' unless the `"' is preceded by `\'.  Since this fine print does not seem 
> to be supported for `!', I didn't try to add it here.  Due to prior 
> transformations on the index key strings, it would take 	a bit of research 
> to get this right.

Perhaps this use of | is an undocumented feature of  \index  without 'makeidx'.
Hmm; no it isn't.

My guess now is that you use the  makeindex  program to process your .idx
file into an .ind file, *without* loading the 'makeidx' package.
This would result in the | expressions being transformed into valid LaTeX
expressions for styles. You don't get any errors, since there are no
undefined macros involved. Whereas with ", ! and @ there may be macro names 
that need definitions from  makeidx.sty .

I think that it's fair to say that you are using | in a way that wasn't intended.
That is, you are supposed to be loading \usepackage{makeidx} whenever you are
using the  makeindex program.


In any case, I'll think about adding your 1-line hack to latex2html,
as it is probably harmless, in practice.


Thanks for the report,

	Ross Moore



> Julius
> 
> _______________________________________________
> latex2html mailing list
> latex2html@tug.org
> http://tug.org/mailman/listinfo/latex2html