diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-06 21:12:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-06 21:12:39 +0000 |
commit | a214e25aa35703933434387c49111d827d19ebca (patch) | |
tree | 12e128e6b383b8cbc114c088360f88206345187f /Master/texmf-dist/doc/latex/keyindex/makenameindex | |
parent | cb80c8476ad28cf03650f087acc7062a148268a6 (diff) |
keyindex (6apr19)
git-svn-id: svn://tug.org/texlive/trunk@50814 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/keyindex/makenameindex')
-rwxr-xr-x | Master/texmf-dist/doc/latex/keyindex/makenameindex | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/keyindex/makenameindex b/Master/texmf-dist/doc/latex/keyindex/makenameindex new file mode 100755 index 00000000000..32e70da4199 --- /dev/null +++ b/Master/texmf-dist/doc/latex/keyindex/makenameindex @@ -0,0 +1,31 @@ +if [ -z $1 ]; then +echo usage: makenameindex infile +echo +echo Produces a file infile.kix, suitable for importing in the preamble of +echo a LaTeX file, which provides the command \name\<key\>. Usually, \<key\> +echo will be a last name, and \name\<key\> will insert the last name in the +echo text as well as an index entry of the form last name, first name. The +echo file is generated from infile.txt, which contains lines of the form +echo +echo last name, first name +echo key\|last name, first name +echo key@indexentry +echo +echo key\|last name, first name is used to disambiguate people with the same +echo last name. key@indexentry is used to typeset \<key\> in the text +echo but index indexentry, e.g., Euklid@Euclid. +else +echo makenameindex $1.txt, writing to $1.kix +for key in `grep -o '^[^|@,]*' $1.txt` ; do +if [ `grep -c "^$key[|@,]" $1.txt` -gt 1 ]; then + echo "Key $key defined more than once!" +fi +done +echo "% $1.kix" > $1.kix +echo "% Generated from $1.txt on `date`" >> $1.kix +grep '|' $1.txt | sed 's/^\([^|]*\)|\([^,]*\), *\(.*\)/\\keyindexentry{\1}{\2}{\2, \3}/' >>$1.kix +grep '@' $1.txt | grep -v '@.*@' | sed 's/^\([^@]*\)@\(.*\)/\\keyindexentry{\1}{\1}{\2}/' >>$1.kix +grep '@' $1.txt | grep '@.*@' | sed 's/^\([^@]*\)@\([^@]*\)@\(.*\)/\\keyindexentry{\1}{\2}{\3}/' >>$1.kix +grep -v '[|@]' $1.txt | sed 's/^\([^,]*\), *\(.*\)/\\keyindexentry{\1}{\1}{\1, \2}/' >>$1.kix +sort -o $1.kix $1.kix +fi
\ No newline at end of file |