On Thu, 5 Oct 2006, Henning Hraban Ramm wrote:
While I can't cope with counters, I'm trying other stuff that I don't understand: How must I use \doifdefined & friends?
Consider this snippet:
----- \starttext
\def\myvar{JAJAJA}
\input tufte \doifdefined{\myvar}{\par bla \myvar blub\par} \input tufte
\stoptext -----
I'd guess it would print "bla JAJAJAblub" between the two Tufte texts and don't if I comment \def\myvar.
But I guess wrongly: It does nothing in this case, and complains about undefined \myvar in the latter.
That is because \doifdefined is for strings. It adds a \csname ... \endcsname around its first argument.
But if I really want to check if something is defined before I try to use it, how must I write it?
The plain tex way \ifx\myvar\undefined %Nothing here \else \par bla \myvar blub\par \fi or the context way (for strings) \doifdefined{myvar}{\par bla \myvar blub\par} Aditya