# How to add a prefix to citations and references numbers in latex?

I am looking to add a prefix, say P to the reference list, so:

(1) the list will appear like

References

[P1] ...

[P2] ..

(2) when I cite them they appear as [P1] also.

I added the following to the preamble

\makeatletter

\def\@biblabel#1{[P#1]}

\makeatother


but this achieves the first requirement, not the second. So now when I cite the citation still appears as [1].

How to remedy this?

Thanks

• Are you really using biblatex as your tagging suggests? \def\@biblabel#1{[P#1]} should not work in that case. You would use refcontexts and labelprefix with biblatex. – moewe Aug 30 '17 at 21:11
• Assuming you're actually using BibTeX, not biblatex, which bibliography style do you employ? Do you load a citation management package such as cite or natbib? – Mico Aug 30 '17 at 21:52

This solution works only with older version (3.4) of biblatex

I think that you are looking for the following solution:

\documentclass{article}

\usepackage[backend=bibtex]{biblatex}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{lamport1994latex,
title={LATEX: a document preparation system: user's guide and reference manual},
author={Lamport, Leslie},
year={1994},
}
@book{mittelbach2004latex,
title={The LATEX companion},
author={Mittelbach, Frank and Goossens, Michel and Braams, Johannes and Carlisle, David and Rowley, Chris},
year={2004},
}
\end{filecontents*}

\pagenumbering{gobble}

\begin{document}

\cite{lamport1994latex} is the one we started our journey with. Then
we also got~\cite{mittelbach2004latex}.  Both
\cite{lamport1994latex,mittelbach2004latex} are good ones.

\printbibliography[prefixnumbers=P]

\end{document}


For details, please see page 76 of the biblatex documentation.

• With newer versions of biblatex prefixnumbers has been renamed to labelprefix, the option can now only be used from a refcontext command. Your answer only works with outdated version of the software. – moewe Aug 31 '17 at 5:55
• The fact that \def\@biblabel#1{[P#1]} solved one part of the problem shows that the OP can't be using biblatex. With biblatex, \def\@biblabel#1{[P#1]} does nothing. – moewe Aug 31 '17 at 5:56
• @moewe Sorry, did not note that. Actually, without a MWE, we can only make educated guesses, we can only presume and sometimes we can only conclude about the real scenario. And the askers seem to be real misers when putting their own codes in questions. They do not understand that they need to help us helping them. May be with this answer, the OP will decide switching to biblatex. – Masroor Aug 31 '17 at 6:12
• Yes we are all guessing. But the problem with this answer is that it only works for outdated versions of biblatex. I wouldn't have complained otherwise, for the current version 3.7, however, this answer is practically useless. – moewe Aug 31 '17 at 6:34
• It is a well-'loved' feature that Ubuntu and other Linux systems often ship stable (i.e. older or outdated) TeX live versions in their package repositories. If you want to live on the cutting edge, go with a vanilla TeX live (tex.stackexchange.com/q/1092/35864). Manually updating certain packages risks version incompatibilities. (Certainly between biblatex and Biber, likely with custom biblatex styles, maybe with other packages as well.) – moewe Aug 31 '17 at 6:59

With current versions of biblatex, you need to use refcontexts for labelprefix

\documentclass{article}

\usepackage[backend=biber,defernumbers=true]{biblatex}

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{lamport1994latex,
title={LATEX: a document preparation system: user's guide and reference manual},
author={Lamport, Leslie},
year={1994},
}
@book{mittelbach2004latex,
title={The LATEX companion},
author={Mittelbach, Frank and Goossens, Michel and Braams, Johannes and Carlisle, David and Rowley, Chris},
year={2004},