[texhax] Making an index in TeXShop

Paul J. Campbell campbell at beloit.edu
Fri May 21 19:19:24 CEST 2010

The simple TeX code below will prepare an index file, provided the 
terms to be indexed have been flagged accordingly. This particular 
version is designed to index each term only at first appearance; 
duplicate flags will produce duplicated entries with different page 
numbers, which can be collocated later by hand.

 From a list of terms to be indexed, flags can be inserted 
automatically via the Windows or Unix versions of the program 
forindex (no Mac version available!), from


This is designed to work with LaTeX files but should work with any 
text file. I have used the Windows version with success. There is 
also a predecessor Perl script (which I have not tried yet) called 
ixgen (not the same as the IXgen used with FrameMaker!). This script 
is not currently available via search on the Internet but you can get 
it at the Wayback Machine:


Please let me know if you find better tools.

Best regards,

Paul Campbell

===========code follows===========


\proofmodetrue %should be set to false when camera ready

\def\7#1{\write\inx{#1, \string\hfil\space \the\pageno}}

\def\8#1#2{#1\write\inx{#1, SEE #2.}}

\def\9#1#2{\write\inx{#1, SEE ALSO #2}}

\def\5#1{\ifproofmode \vadjust{\leftline{\smash{\llap{
$\vcenter{\hsize=.35in {\rm index}}$ \ \ }}}}
\fi \write\inx{#1, \string\hfil\space \the\pageno}} % 7 with indx mark

\def\5#1{\ifproofmode \vadjust{\leftline{\smash{\llap{
$\vcenter{\hsize=.35in {\rm index}}$ \ \ }}}}
\fi \write\inx{#1, \string\hfil\space \the\pageno}} % 7 with indx mark

=======corresponding sample index entries in book file=======

  \5{invariant set}

  \8{$E(X)$}{enveloping semigroup}\7{$E(X)$}

  \8{minimal set}{minimal}

  \9{ideal}{minimal ideal}


Paul J. Campbell
Mathematics and Computer Science
Beloit College
700 College St.
Beloit, WI  53511-5595

ofc:  (608) 363-2007
fax: (608) 363-2052
res:  (608) 362-2805

web page: http://cs.beloit.edu/campbell

More information about the texhax mailing list