(eplain.info)Page list and page range parsers


Prev: User-defined environments Up: Programming definitions
Enter node , (file) or (file)node

7.12 Page list and page range parsers
=====================================

The macros which Eplain uses to parse the page lists and ranges in the
index, '\idxparselist' and '\idxparserange' (Note: Page destinations for
index terms), are sometimes useful when defining page number
encapsulators. They take one argument, text to parse. When a page list
(range) is not present, they set '\idxpagei' to be '\empty'; when a list
(range) is detected, they set '\idxpagei' and '\idxpageii' to the first
and the second page numbers, respectively.

   Eplain's defaults for the page list and page range delimiters are the
same as those in MakeIndex, a comma followed by a space (', ') and two
dashes ('--'), respectively. If you customize MakeIndex to use different
delimiters, you must not forget to let Eplain know about them with the
commands

     \setidxpagelistdelimiter{LIST-DELIM}
     \setidxpagerangedelimiter{PAGE-DELIM}

These commands save the LIST-DELIM and PAGE-DELIM delimiters in
'\idxpagelistdelimiter' and '\idxpagerangedelimiter', respectively.

   For example, you may want to define a page number markup command
which italicizes and properly underlines page ranges by underlining only
the page numbers and not the delimiter:

     \def\ituline#1{%
       {\it
       \idxparserange{#1}%
       \ifx\idxpagei\empty
         % The argument is a single page number.
         \underbar{#1}%
       \else
         % The argument is a page range.
         \underbar{\idxpagei}\idxpagerangedelimiter\underbar{\idxpageii}%
       \fi}%
     }

Note that the '\ituline' macro is not aware of page lists. This is not
needed if you use hyperlinks in the index, because '\hlidx' and
'\hlidxpage' will break up the page lists before calling the user's page
encapsulator (Note: Page destinations for index terms), so '\ituline'
will never see the lists. If, however, you need to design a macro which
also takes care of the lists, you can extend '\ituline' with an
additional call to '\idxparselist'.


automatically generated by info2www version 1.2.2.9