[tex-eplain] Indexing causes erors.

Dan Luecking luecking at uark.edu
Fri Jun 27 20:01:42 CEST 2008


At 05:55 AM 6/27/2008, John Culleton wrote:
>On Thursday 26 June 2008 11:24:31 pm Oleg Katsitadze wrote:
> > On Thu, Jun 26, 2008 at 05:01:53PM -0400, John Culleton wrote:
> > > In my last pass through my current project I added a bunch of
> > > indexing tags. Unfortunately they had the effect of eliminating a
> > > space after the word indexed.
> >
> > But this is the intended behavior of the "silent" commands:
>
>Eliminating a space within the {foo} makes sense. Eliminating a space
>after the {foo} makes no sense.  Now I have to put a carriage return
>or a \ (space) after each occurrence of \sidx{foo}.

This is likely a consequence of having a following optional argument.
A left bracket is searched for with \@futurenonspacelet which skips
spaces.

In something like "Foo\sidx{foo} is ..." it finds "i" and concludes
there is no optional argument. But all literal spaces are lost (it
even doesn't keep track of having lost any). This has the advantage
of allowing optional arguments to behave like mandatory ones (a space
or linebreak before it is ignored). It is certainly possible for a
more complex macro to keep track of space tokens and put them back.

Spaces after an optional argument could be retained, but it would
be inconsistent to have a space after \sidx{foo}[bar] and not
after \sidx{foo}.

One way to deal with this is to put silent indexing commands before
the term they index: "\sidx{foo}Foo is ...".


Dan


Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Dubito ergo cogito, cogito ergo sum" --Descarte



More information about the tex-eplain mailing list