# Printing \ref as a letter

When using \label and \ref, can I get the \ref to display as a letter instead of a number (so if \ref is 3, it will print c instead)?

-
It's quite unclear what you want: if the item to which you are referring is numbered 3, then the reference should show that number. – egreg Feb 10 '12 at 0:02

The default counter representation is \arabic (or numerical). If you want a counter to be referenced alphabetically rather than numberically, then you can redefine the representation using

\newcounter{mycount}
\renewcommand{\themycount}{\alph{mycount}}


\the<counter> refers to the representation of the counter. So you're essentially redefining it from being displayed as \arabic to \alph.

If you don't care about what is displayed and how it's referenced, then the following will work:

\documentclass{article}
\usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
\begin{document}
\setcounter{section}{2}
\section{This is a section}\label{ref:section}
This is section~\ref{ref:section}. This is section~\aaalphnum{\ref{ref:section}}.
\end{document}


The fmtcount package can easily be used to convert between different number formats.

-
I was wondering if there were a way to do this other than to counter names. – Ryan Reich Feb 10 '12 at 0:11

Any counter can be printed alphabetically using the command \alph{counter}. You can make that work with \label and \ref by redefining the counter you are referencing to print things that way. For example, to refer to sections by letter, write:

\documentclass{article}
\renewcommand\thesection{\alph{section}}
\begin{document}
\section{A section}
\label{s:a section}

In section \ref{s:a section}\dots
\end{document}


Of course, all your sections will be "lettered" rather than numbered; however, it is very confusing to refer to a numbered item by letter, so this is probably what you should do anyway if you want references to print letters.

-