Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!ariel.unm.edu!news From: wester@ghostwheel.unm.edu (Michael Wester) Newsgroups: comp.text.tex Subject: Problem using \write Message-ID: <1990Dec13.090011.15883@ariel.unm.edu> Date: 13 Dec 90 09:00:11 GMT Sender: news@ariel.unm.edu (USENET News System) Organization: University of New Mexico Math Dept., Albuquerque, NM Lines: 28 I have been trying to understand the \length macro defined on page 219 of the TeXbook. All is well until I try to \write out a result. In particular, I TeX the following: % Define \length, even to the point of using the same unreadable spacing as % found in the TeXbook, just to be sure there that are no subtle errors. \def\length#1{{\count0=0 \getlength#1\end \number\count0}} \def\getlength#1{\ifx#1\end \let\next=\relax \else\advance\count0 by1 \let\next=\getlength\fi \next} \def\qqq{\length{argument}} % try out an example \qqq % this causes an 8 to be written in the DVI file \immediate\write16\qqq % however, this causes an error The error is ! Undefined control sequence. \getlength ... etc. Replacing \def by \edef causes the same problem. I presume the \write causes the same sort of expansion as \edef. So, how does one view the result interactively (if one is debugging on a non-graphics terminal and wishes to avoid doing frequent octal dumps) and better, how can I make the \edef and/or \write work? A simple answer would be nice but from my experience so far, I don't really expect TeX programming to be simple! -- Michael Wester --- wester@ghostwheel.UNM.Edu (Internet), wester@unmb (BITNET) Department of Mathematics, University of New Mexico, Albuquerque, New Mexico