[texhax] Can I invoke some tex command at commank like this?

Ian Collier imc at comlab.ox.ac.uk
Fri Sep 26 12:30:31 CEST 2003

redduzt at yahoo.com (Chakrit Nimmanant) writes:
>    I have an example like this:
>   "\setbox0 = \hbox{Evam}
>The box has width \the\wd0, height \the\ht0, and depth

>    As you can see, TeX is very useful to determine
>the dimension of my "Evam". So,I want to invoke some
>TeX commands on standard input which can receive
>"Evam" as a parameter and returns a value of \wd0 to
>my standard output.

Do you mean something like this?

 \read16 to\text
 \if T\ifx\text\empty F\else T\fi
  \message{The box has width \the\wd0, height \the\ht0, and depth \the\dp0.}

(This carries on reading until you enter an empty line, then stops.
If you don't need it to loop then you just need the \read, \setbox
and \message lines.  The \catcode line makes TeX ignore the carriage
return on the end of whatever you type.  Replace the number 16 by -1
if you don't want TeX to prompt with "\text=" before you type in the
---- Ian Collier : imc at comlab.ox.ac.uk : WWW page below
------ http://users.comlab.ox.ac.uk/ian.collier/imc.shtml

More information about the texhax mailing list