[texhax] Making an index in TeXShop
Michael Doob
mdoob at ccu.umanitoba.ca
Fri May 21 20:07:26 CEST 2010
On Friday 21 May 2010 12:19 pm, Paul J. Campbell wrote:
> 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.
...
> ===========code follows===========
>
> \newwrite\inx
> \openout\inx=index.TEX
>
> \newif\ifproofmode
> \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
Two comments:
1. \immediate\write will flush the writing buffers before \pageno has
a chance to change.
2. If a paragraph is split across two pages by the output routine,
the \pageno value might be off by one.
Cheers,
Michael
--
------------------------------------------------------------------
Michael Doob Telephone: (204) 474-9796
Department of Mathematics Fax: (204) 474-7606
University of Manitoba email: Michael_Doob at umanitoba.ca
Winnipeg, MB, Canada R3T 2N2
------------------------------------------------------------------
More information about the texhax
mailing list