src/Doc/isac/jrocnik/sedindex
author Walther Neuper <neuper@ist.tugraz.at>
Sun, 14 Jul 2013 14:48:14 +0200
changeset 52056 f5d9bceb4dc0
parent 42293 doc-src/isac/jrocnik/sedindex@b24574463e1a
permissions -rwxr-xr-x
merged
jan@42293
     1
#! /bin/sh
jan@42293
     2
#
jan@42293
     3
#sedindex - shell script to create indexes, preprocessing LaTeX's .idx file
jan@42293
     4
#
jan@42293
     5
#  puts strings prefixed by * into \tt font
jan@42293
     6
#    terminator characters for strings are |!@{}
jan@42293
     7
#
jan@42293
     8
# a space terminates the \tt part to allow \index{*NE theorem}, etc.
jan@42293
     9
#
jan@42293
    10
# change *"X"Y"Z"W  to  "X"Y"Z"W@{\tt "X"Y"Z"W}
jan@42293
    11
# change *"X"Y"Z    to  "X"Y"Z@{\tt "X"Y"Z}
jan@42293
    12
# change *"X"Y      to  "X"Y@{\tt "X"Y}
jan@42293
    13
# change *"X        to  "X@{\tt "X}
jan@42293
    14
# change *IDENT  to  IDENT@{\tt IDENT}  
jan@42293
    15
#    where IDENT is any string not containing | ! or @
jan@42293
    16
# FOUR backslashes: to escape the shell AND sed
jan@42293
    17
sed -e "s~\*\(\".\".\".\".\)~\1@{\\\\tt \1}~g
jan@42293
    18
s~\*\(\".\".\".\)~\1@{\\\\tt \1}~g
jan@42293
    19
s~\*\(\".\".\)~\1@{\\\\tt \1}~g
jan@42293
    20
s~\*\(\".\)~\1@{\\\\tt \1}~g
jan@42293
    21
s~\*\([^ |!@{}][^ |!@{}]*\)~\1@{\\\\tt \1}~g" $1.idx | makeindex -c -q -o $1.ind