# How to change labels of references to letters?

I would like to change the labels of references to alphabetic characters. such as

[a] authors, article.


How can I achieve this goal in latex without labeling each reference by hand for each item using, e.g., \bibitem[a]?

Furthermore, the counter alph cannot exceed 26, it would be nice if the answer to my question can also solve this problem such that the 27th is aa, the 28th is bb, and so on.

Thank you.

The alphalph packages will produce counters of this form. You can incorporate these in to the bibliography mechanism by redefining \@bibitem and \@biblabel:

\documentclass{article}

\usepackage{alphalph,cite}

\makeatletter
\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
{\string\bibcite{#1}{\alphalph{\value{\@listctr}}}}\fi\ignorespaces}
\def\@biblabel#1{[\alphalph{#1}]}
\makeatother

\begin{document}
\nocite{*}\cite{phdthesis-minimal}

\bibliographystyle{plain}
\bibliography{xampl}
\end{document}


From the comment, you say you also want to apply this a standalone thebibliography environment, where there is a second such environment present.
This can be achieved by moving the commands in the preamble inside the environment.

\documentclass{article}

\usepackage{alphalph,cite}

\begin{document}
\cite{a2,x28}

\begin{thebibliography}{9}
\bibitem{a1} Source.
\bibitem{a2} Source.
\bibitem{a3} Source.
\end{thebibliography}

\begin{thebibliography}{99}
\makeatletter
\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
{\string\bibcite{#1}{\alphalph{\value{\@listctr}}}}\fi\ignorespaces}
\def\@biblabel#1{[\alphalph{#1}]}
\makeatother
\bibitem{x1} Reference.
\bibitem{x2} Reference.
\bibitem{x3} Reference.
\bibitem{x4} Reference.
\bibitem{x5} Reference.
\bibitem{x6} Reference.
\bibitem{x7} Reference.
\bibitem{x8} Reference.
\bibitem{x9} Reference.
\bibitem{x10} Reference.
\bibitem{x11} Reference.
\bibitem{x12} Reference.
\bibitem{x13} Reference.
\bibitem{x14} Reference.
\bibitem{x15} Reference.
\bibitem{x16} Reference.
\bibitem{x17} Reference.
\bibitem{x18} Reference.
\bibitem{x19} Reference.
\bibitem{x20} Reference.
\bibitem{x21} Reference.
\bibitem{x22} Reference.
\bibitem{x23} Reference.
\bibitem{x24} Reference.
\bibitem{x25} Reference.
\bibitem{x26} Reference.
\bibitem{x27} Reference.
\bibitem{x28} Reference.
\bibitem{x29} Reference.
\bibitem{x30} Reference.
\end{thebibliography}

\end{document}


If you want to do this with an external database, then you could use the multibib package and make similar adjustments local to the one bibliography.

• Thank you very much for your quick answer. In fact, I have additional requirement, which was not specified in the post, sorry for that. I in fact need also the normal reference numeric labels. That is, in some part, I need the alphabetic and in the other part I need numeric. Thus, what I want most is a new thebibliography environment, call it thebibliographyalph for instance. How would your suggestion be translated into such an environment? – unstable Jul 9 '15 at 14:22
• @AndrewSwann if ones uses hyperref package, the citation number will be redefined to Arabic number!!! – Say OL Jul 27 '15 at 15:52
• @SayOL That is a standard problem with hyperref and modifications to the bibliography commands. A work around is to load hyperref with implicit=false, but then many hyperlinks are simply not created. Otherwise one has to write commands that are modelled on hyperref's versions of \@bibitem and \@biblabel. – Andrew Swann Aug 5 '15 at 10:04

This is not a new answer, it is just something too long to be left as comment.

In the comments to the great answer of Andrew Swann, there is the discussion about how to proceed not to break the hyperref behaviour. Since I had exactly this need when I came here, I decided to leave what I did as a possible patch for other users.

Desclaimer: It is quick and dirty, use it with a pinch of salt. Actually, here it is just about putting a prefix to the full bibliography, but anyone can use this as a starting point for her/his needs.

Looking at how the \@bibitem is redefined in the hyperref command,

\def\@bibitem#1{%
\@skiphyperreftrue\H@item\@skiphyperreffalse
\hyper@anchorstart{cite.#1\@extra@b@citeb}\relax\hyper@anchorend
}%
\if@filesw
\begingroup
\let\protect\noexpand
\immediate\write\@auxout{%
\string\bibcite{#1}{\the\value{\@listctr}}%
}%
\endgroup
\fi
\ignorespaces
}%


it should not be so hard to insert a prefix into the \bibcite call. Of course, this has to go together with a redefinition of \@biblabel as also shown by Andrea Swann.

Then I decided to create a changeBibPrefix command in order to redefine correctly the needed macros.

\makeatletter
\newcommand{\changeBibPrefix}[1]{%
\def\@bibitem##1{%
\@skiphyperreftrue\H@item\@skiphyperreffalse
\hyper@anchorstart{cite.##1\@extra@b@citeb}\relax\hyper@anchorend
}%
\if@filesw
\begingroup
\let\protect\noexpand
\immediate\write\@auxout{%
\string\bibcite{##1}{#1\the\value{\@listctr}}%
}%
\endgroup
\fi
\ignorespaces
}
\def\@biblabel##1{[#1##1]}
}
\makeatother


The only thing to pay attention here is to use #1 to identify the prefix passed to the \changeBibPrefix command and ##1 to identify the \@bibitem or \@biblabel macro argument.

At this point one can put all together in an example, where I decided to make the number in the bibliography continue.

\documentclass{article}
\usepackage{enumitem,lipsum}
\usepackage[colorlinks = true, citecolor = blue]{hyperref}

\newcounter{bibIndex}

\makeatletter
\newcommand{\changeBibPrefix}[1]{%
\def\@bibitem##1{%
\@skiphyperreftrue\H@item\@skiphyperreffalse
\hyper@anchorstart{cite.##1\@extra@b@citeb}\relax\hyper@anchorend
}%
\if@filesw
\begingroup
\let\protect\noexpand
\immediate\write\@auxout{%
\string\bibcite{##1}{#1\the\value{\@listctr}}%
}%
\endgroup
\fi
\ignorespaces
}
\def\@biblabel##1{[#1##1]}
}
\makeatother

\begin{document}

\section{Some section}
\lipsum[1-3] Cite \cite{ref1} and cite \cite{ref2}. \lipsum[2]

\changeBibPrefix{P}
\renewcommand{\refname}{First bibliography}
\begin{thebibliography}{9}
\bibitem{ref1} First reference
\bibitem{ref2} Second reference
\setcounter{bibIndex}{\value{enumiv}}
\end{thebibliography}

\section{Some other section}
\lipsum[1] Cite \cite{ref1} and cite \cite{ref3}. \lipsum[2-5]

\changeBibPrefix{R}
\renewcommand{\refname}{Second bibliography}

\begin{thebibliography}{9}
\setcounter{enumiv}{\value{bibIndex}}
\bibitem{ref3} Third reference
\end{thebibliography}

\end{document}