From 24881134d0e4e08d7176a50b86d2ce23e4b950eb Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 20 Sep 2008 00:27:23 +0000
Subject: esindex 1.3 (17sep08)

git-svn-id: svn://tug.org/texlive/trunk@10642 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/bezos/esindex.sty | 65 +++++++++++++++++++++++----
 1 file changed, 56 insertions(+), 9 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/bezos/esindex.sty')

diff --git a/Master/texmf-dist/tex/latex/bezos/esindex.sty b/Master/texmf-dist/tex/latex/bezos/esindex.sty
index 6975fd02cab..29c6d584b2b 100644
--- a/Master/texmf-dist/tex/latex/bezos/esindex.sty
+++ b/Master/texmf-dist/tex/latex/bezos/esindex.sty
@@ -2,7 +2,7 @@
 % | Typeset ensindex.tex to get the documentation.   |
 % +--------------------------------------------------+
 %
-%% Copyright (C) 1998-2004, 2006 Javier Bezos
+%% Copyright (C) 1998-2004, 2006, 2008 Javier Bezos
 %% All Rights Reserved
 %% http://www.tex-tipografia.com
 %%
@@ -23,8 +23,12 @@
 % Changes
 %
 % 2006/05/12. Bug fixed. Missing accents in multilevel entries.
+% 2008/09/17. Made compatible with latest LaTeX versions (\IeC).
+%             Added \'\i.
+%             Package option ignorespaces.
+%             Macro \ignorewords.
 
-\ProvidesPackage{esindex}[2006/05/12 v1.2 Spanish indexes]
+\ProvidesPackage{esindex}[2008/09/17 v1.3 Spanish indexes]
 
 \def\esx@level{`\!}
 \def\esx@actual{`\@}
@@ -32,10 +36,10 @@
 \def\esx@quote{`\"}
 
 \def\esx@error{\PackageError{esindex}{Unknown index parameter}%
-	   {Options in this package have the form^^J%
-	    parameter=value, where parameter stands for^^J%
-		one of the following MakeIndex ones:^^J%
-		encap, level, actual, quote}}
+	   {Except for ignorespaces and replaceindex, options^^J%
+           in this package ave the form parameter=value, where^^J%
+           parameter stands for of the following MakeIndex ones:^^J%
+           encap, level, actual, quote}}
 
 \def\esx@process#1=#2\esx@process{%
   \@ifundefined{esx@#1}{\esx@error}{%
@@ -47,9 +51,23 @@
   \ifin@
     \expandafter\esx@process\CurrentOption\esx@process
   \else
-    \esx@error
+    \def\esx@a{ignorespaces}
+    \ifx\esx@a\CurrentOption
+      \def\esx@zapspace#1\esx@zapspace{\zap@space#1 \@empty}%
+    \else\def\esx@a{replaceindex}
+      \ifx\esx@a\CurrentOption
+         \AtBeginDocument{%
+           \let\esx@trueindex\index
+           \let\index\esindex}
+       \else
+         \esx@error
+      \fi
+    \fi
   \fi}
 
+\let\esx@zapspace\@empty
+\def\esx@trueindex{\index}
+
 \ProcessOptions
 
 \begingroup
@@ -71,7 +89,7 @@
   \esx@bar@idx#2|\@@
   \expandafter\esx@@index\esx@b!\@@
   \toks@\expandafter{\esx@g}%
-  \protected@edef\esx@g{\noexpand\index#1{\the\toks@\esx@a}}%
+  \protected@edef\esx@g{\noexpand\esx@trueindex#1{\the\toks@\esx@a}}%
   \esx@g}
 }
 
@@ -88,6 +106,7 @@
 \lowercase{
 \gdef\esx@@index#1!#2\@@{%
   \begingroup
+  \let\IeC\@firstofone
   \def\@tabacckludge##1{\csname\string##1\endcsname}%
   \def\'##1{\@ifundefined{esx@index@q@\string##1}%
        {##1}%
@@ -105,8 +124,16 @@
   \ifnum\catcode`\"=\active
     \let"\"%
   \fi
+  \@temptokena{#1}%
+  % Particles
+  \@for\esx@a:=\esx@ignorewords\do{%
+     \expandafter\esx@remwords\expandafter{\esx@a}}%
   \toks@\expandafter{\esx@g}%
-  \protected@xdef\esx@g{\the\toks@#1\string &}%
+  % Adds @ and removes spaces.
+  \protected@xdef\esx@g{%
+    \the\toks@
+    \expandafter\esx@zapspace\the\@temptokena\esx@zapspace
+    \string &}%
   \endgroup
   \begingroup
   \def*##1{% <- its lower case is the quote char (")
@@ -129,8 +156,28 @@
 }
 \endgroup
 
+\def\ignorewords#1{%
+  \protected@edef\esx@ignorewords{\zap@space#1 \@empty}}
+
+\let\esx@ignorewords\@empty
+
+\def\esx@remwords#1{%
+  \def\esx@c##1 #1 \esx@c{\esx@a##1 #1 \esx@a}%
+  \def\esx@a##1 #1 ##2\esx@a{%
+     \ifx\@empty##2\@empty
+       \@firstofone##1##2%
+     \else
+       \@firstofone##1 \esx@c##2\esx@c
+     \fi}%
+  \expandafter\esx@remwords@ii\expandafter{\the\@temptokena}{#1}}%
+
+\def\esx@remwords@ii#1#2{%
+  \protected@xdef\esx@b{\expandafter\esx@a\space#1 #2 \esx@a}%
+  \@temptokena\expandafter{\esx@b}}
+
 \def\esx@index@q@n{n\string^^ff}
 \def\esx@index@q@N{N\string^^ff}
+\@namedef{esx@index@q@\string\i}{i}
 
 \def\esx@index@qq@o{.o}
 \def\esx@index@qq@O{.O}
-- 
cgit v1.2.3

