Path: utzoo!attcan!uunet!mcsun!ukc!edcastle!edcogsci!lex From: lex@cogsci.ed.ac.uk (Alexander Holt) Newsgroups: comp.text.tex Subject: How can I get TeX to see LaTeX \ref{...} as a ? Message-ID: <1538@scott.ed.ac.uk> Date: 13 Jul 90 15:39:00 GMT Organization: Centre for Cognitive Science, Edinburgh, UK Lines: 48 [I did try a month ago, but no response] I'm writing some LaTeX macros in which I would like to turn an integer into the corresponding lowercase letter, thus 1 -> a, 2 -> b, etc. LaTeX sometimes needs to do this itself for the value of counters and uses these definitions: \def\@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi} \def\@ialph#1{\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else\@ctrerr\fi} \def\@ctrerr{\@latexerr{Counter too large}\@ehb} Here the TeX command \ifcase is used - which expects a . My problem is that I would sometimes like to do: \@alph{\ref{...}} where the \ref{...} is a LaTeX reference to a counter. But I get the error: ! Missing number, treated as zero. \edef \edef \@tempa {\@nameuse {r@ex:big2}}\expandafter \@car \@tempa \... \@ifundefined ...me #1\endcsname \relax #2\else #3 \fi \@alph #1->\ifcase #1 \or a\or b\or c\or d\else \@ialph {#1}\fi ... since the \ref{...} expands into this \edef ... sequence and TeX cannot interpret this as a number. How can I arrange things so that \ifcase finds the number eventually produced by \ref? (This all assumes that the label being \ref'd is defined at this point - when it is not, then I have a different problem! I would like a way to detect this case by examining the output of \ref so that I can bypass the call to \@alph and avoid an error.) I would be very grateful for any advice on this. Lex Holt (lex@cogsci.ed.ac.uk)