try {
reader = new BufferedReader(new FileReader(tex));
StreamTokenizer toki = new StreamTokenizer(reader);
toki.resetSyntax();
toki.eolIsSignificant(false);
toki.commentChar('%');
toki.wordChars('a', 'z');
toki.wordChars('A', 'Z');
toki.wordChars('0', '9');
toki.wordChars('-', '-');
toki.wordChars(' ', ' ');