doc-isac/jrocnik/sedindex
changeset 52107 f8845fc8f38d
parent 52056 f5d9bceb4dc0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc-isac/jrocnik/sedindex	Tue Sep 17 09:50:52 2013 +0200
     1.3 @@ -0,0 +1,21 @@
     1.4 +#! /bin/sh
     1.5 +#
     1.6 +#sedindex - shell script to create indexes, preprocessing LaTeX's .idx file
     1.7 +#
     1.8 +#  puts strings prefixed by * into \tt font
     1.9 +#    terminator characters for strings are |!@{}
    1.10 +#
    1.11 +# a space terminates the \tt part to allow \index{*NE theorem}, etc.
    1.12 +#
    1.13 +# change *"X"Y"Z"W  to  "X"Y"Z"W@{\tt "X"Y"Z"W}
    1.14 +# change *"X"Y"Z    to  "X"Y"Z@{\tt "X"Y"Z}
    1.15 +# change *"X"Y      to  "X"Y@{\tt "X"Y}
    1.16 +# change *"X        to  "X@{\tt "X}
    1.17 +# change *IDENT  to  IDENT@{\tt IDENT}  
    1.18 +#    where IDENT is any string not containing | ! or @
    1.19 +# FOUR backslashes: to escape the shell AND sed
    1.20 +sed -e "s~\*\(\".\".\".\".\)~\1@{\\\\tt \1}~g
    1.21 +s~\*\(\".\".\".\)~\1@{\\\\tt \1}~g
    1.22 +s~\*\(\".\".\)~\1@{\\\\tt \1}~g
    1.23 +s~\*\(\".\)~\1@{\\\\tt \1}~g
    1.24 +s~\*\([^ |!@{}][^ |!@{}]*\)~\1@{\\\\tt \1}~g" $1.idx | makeindex -c -q -o $1.ind