# Put \ref{} within \aaalphanum

I'm trying to ref a label using \ref and output an alphabetical letter (e.g. 'A') rather than the number (e.g. 1).

I have read somewhere to use \AAAlphanum{\ref{my_label}} but this command fails

Missing number, treated as zero.

Any help is greatly appreciated.

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Dec 24, 2014 at 1:17
• @ the close voter: please give the OP time to make the question more clear before voting to close and if you're really going to vote to close this early, at least live a comment suggesting how the question could be improved/clarified. Dec 24, 2014 at 1:18

There are a number of ways you can achieve this:

\documentclass{article}
\usepackage{zref,refcount,alphalph,hyperref}

\makeatletter
\zref@newprop{AlphAlphcntr}[??]{\AlphAlph{\value{section}}}
\newcommand{\mylabel}[1]{\zref@labelbyprops{#1}{AlphAlphcntr}}
\newcommand{\myref}[1]{\zref@refused{#1}\zref@extract{#1}{AlphAlphcntr}}
\makeatother

\setlength{\parindent}{0pt}% Just for this example

\begin{document}

\section{A section}\label{sec:mysection}\mylabel{sec:mysection}
Section~\ref{sec:mysection}. \par
Section~\AlphAlph{\getrefnumber{sec:mysection}}. \par
Section~\myref{sec:mysection}.

\end{document}


The first reference uses \ref, which defaults to whatever the \the<counter> is set to (in this case, \arabic{section}). The second reference uses the expandable \getrefnumber provided by refcount. The last reference uses a custom property list (with the aid of zref) to only store and/or retrieve the \AlphAlph-version of the section counter.

All of the above can be extended to use hyperref, of course.