[tex-eplain] optional arguments

Oleg Katsitadze olegkat at gmail.com
Sun Mar 29 05:37:27 CEST 2009

On Sun, Mar 29, 2009 at 06:21:27AM +0300, Oleg Katsitadze wrote:
> Or you could
> make location into a third-level key, but that would look ugly.

Well, there is a way to achieve this effect, but the hack is ugly and
probably will fail you one day:

      \arch at loc=\expandafter{\@optionalarg}%
        % No optional argument present.
        \expandafter\sidx\expandafter{\the\arch at name}
        % One was present.
        \edef\temp{architects!\the\arch at name, \relax{\noexpand\it \the\arch at loc}}%
        \edef\temp{\the\arch at name, \relax{\noexpand\it architect, \the\arch at loc}}%

All I did was add \relax before location.  This works because it makes
location into a pattern starting with "special symbol" (see the
Ordering section in makeindex docs), and such patterns sort before
letters and numbers.


More information about the tex-eplain mailing list