% %$**Header: /swanhills/prof/hoover/lib/tex/macros/RCS/utility.tex,v 1.1 89/09/01 12:58:45 hoover Exp $ % %$**Log: utility.tex,v $ % Revision 1.1 89/09/01 12:58:45 hoover % Initial revision % % % Special utility macros used by any civilized tex macro package. % % Note for editing: to put a cr into a line using vi do ^V % Note: put space after constant in \ifnum=0 \stuff % % Definitions of special utility macros used to define macros, check if % csnames are already defined, and write messages to the terminal % % def with checking, use the same as a \def eg. % \define\mess{\message{hello there}} % note: dont try and define \relax, it wont catch the error % note: also hope that no one has defined \eat or \dresult \def\eat#1{} \def\define#1{\expandafter\ifx\csname\expandafter\eat\string#1\endcsname\relax \def\dresult{\def#1} \else\errmessage{ERROR - define - \string#1\space is already defined} \def\dresult{\def\garbage} \fi\dresult} % % check if defined, eg. \checkdef\mess \def\checkdef#1{\expandafter\ifx\csname\expandafter\eat\string#1\endcsname\relax \else \errmessage{ERROR - checkdef - \string#1\space is already defined} \fi } % % make sure that spaces are not eaten following a macro invocation. \define\dontignorespaces#1{#1} % % message function to terminal, but each message on new line \define\messagel#1{\immediate\write16{#1}} % % This write expands its argument list immediately, for example: % \expandwrite\refdev{Sequence number \useseq} % will evaluate the sequence number and place it in the token list to write. % Otherwise, if the sequence number is changed before the write % actually occurs the wrong one will be used. % To delay expansion until the page is actually output, as in the case % for page numbers, use \noexpand as in: % \expandwrite\refdev{Used on page \noexpand\folio} % To prevent expansion entirely, as when you want to construct macro calls % for future processing, use \noexpand\noexpand\noexpand as in: % \expandwrite\refdev{\noexpand\noexpand\noexpand\rrefer % {Theorem \useseq\space on page \noexpand\folio}} % There must not be a macro called eewrite floating around. \checkdef\eewrite \define\expandwrite#1#2{% \edef\eewrite{\write#1{#2}}% \ignorespaces\eewrite\ignorespaces} % % this saves having to type 3 \noexpand s, as in % \expandwrite\refdev % {\asis\rrefer{Theorem \useseq\space on page \noexpand\folio}} \define\asis{\noexpand\noexpand\noexpand}