redwidth.tex 652 B

12345678910111213141516171819
  1. \relax
  2. % ---------------------------------------------------------------------
  3. % Interactive module for retrieving width information for T.R.I.
  4. % ---------------------------------------------------------------------
  5. \newbox\testbox\newcount\xxx\newif\ifOK
  6. \def\widthof#1{\message{width is: }
  7. \wwidthof{$\displaystyle#1$}
  8. \wwidthof{$\scriptstyle#1$}
  9. \wwidthof{$\scriptscriptstyle#1$}}
  10. \def\wwidthof#1{\setbox\testbox=\hbox{#1}
  11. \xxx=\wd\testbox\message{[\the\wd\testbox=\the\xxx sp]}}
  12. \def\endloop{end }
  13. \loop\message{Type in TeX item or say 'end': }
  14. \read-1 to\answer
  15. \ifx\answer\endloop\OKfalse\else\OKtrue\fi
  16. \ifOK\widthof{\answer}
  17. \repeat
  18. \end