rcpt@rw9.urc.tue.nl (Piet Tutelaers) (06/10/91)
I am struggling with the following TeX-problem: `\king' is the internal
code for the character denoting a `White king' and `\next' a character
possible being that king, the Black king (lower case value of
`\king') or another character. How does one compare the value of \king
with that of \next? I do see two approaches:
1) convert the value of \king into a \char
\chardef\king=`K
\let\next=k
\def\ucking{\char\king}
\def\lcking{\char\lccode\king}
\if\next\ucking\message{White king}\else
\if\next\lcking\message{Black king}\else
\message{another piece or square}
\fi\fi
\bye
2) convert \next into internal value via \chardef
\chardef\king=`K
\let\next=k
\chardef\square=`\next
\ifnum\square=\king\message{White king}\else
\ifnum\square=\lccode\king\message{Black king}\else
\message{another piece or square}
\fi\fi
\bye
Both solutions fail. The first because the \if-tests fail, the second
because the `\next is not allowed for a \chardef (Improper apphabetic
constant). I hope somebody can show me a REAL solution.
--Piet