#!perl # Upper-case A B C D E F G H I J K L M N O P Q R S T U V W X Y Z # Lower-case a b c d e f g h i j k l m n o p q r s t u v w x y z # Digits 0 1 2 3 4 5 6 7 8 9 # Exclamation ! Double quote " Hash (number) # # Dollar $ Percent % Ampersand & # Acute accent ' Left paren ( Right paren ) # Asterisk * Plus + Comma , # Minus - Point . Solidus / # Colon : Semicolon ; Less than < # Equals = Greater than > Question mark ? # At @ Left bracket [ Backslash \ # Right bracket ] Circumflex ^ Underscore _ # Grave accent ` Left brace { Vertical bar | # Right brace } Tilde ~ # # This program will process the \indexentry lines of a GLO glossary file # (as its standard input) and produce (on its standard output) a LaTeX # snippet that will have \sym entries that will produce the same list of # symbols but without page references. This allows the appendix to be # removed in such a way to leave the list of symbols (where the list of # symbols can be modified and makeindex won't ever regenerate the wrong # list of symbols). # # # The process: # # 1. Include appendix in the document. # 2. Have LaTeX generate the GLO file (makeindex will generate a GLS) # 3. Run this program on the GLO file # 4. Exclude appendix and include the output of this file instead # # ---------------------------------------------------------------------| # --------------------------- 72 characters ---------------------------| # ---------------------------------------------------------------------| print < Question mark ? % At @ Left bracket [ Backslash \ % Right bracket ] Circumflex ^ Underscore _ % Grave accent ` Left brace { Vertical bar | % Right brace } Tilde ~ % ---------------------------------------------------------------------| % --------------------------- 72 characters ---------------------------| % ---------------------------------------------------------------------| EOF while( $line = <> ) { chomp($line); if( $line =~ /\\indexentry\s*{(.*?)@\[(.*?(?:\{.*?\{.*?\}.*?\}.*?)+.*?)\]\s*(.*?)(?:~\\bhypersym\s*\{.*?\}|)(?:\|.*)/) { print "\\sym\{$1\}\{$2\}\{$3\}\n"; #print $1,"_________",$2,"_________",$3,"\n\n"; } elsif( $line =~ /\\indexentry\s*{(.*?)@\[(.*?(?:\{.*?\}.*?)+.*?)\]\s*(.*?)(?:~\\bhypersym\s*\{.*?\}|)(?:\|.*)/) { print "\\sym\{$1\}\{$2\}\{$3\}\n"; #print $1,"_________",$2,"_________",$3,"\n\n"; } elsif( $line =~ /\\indexentry\s*{(.*?)@\[(.*?)\]\s*(.*?)(?:~\\bhypersym\s*\{.*?\}|)(?:\|.*)/ ) { print "\\sym\{$1\}\{$2\}\{$3\}\n"; #print $1,"_________",$2,"_________",$3,"\n\n"; } else { print STDERR "BAD LINE: $line\n\n"; } }