[Tex/LaTex] Custom citation keys

bibtex

I am preparing a publication list in LaTeX in which I'd like to have custom keys to differentiate between paper types. For instance, if I originally I have:

  • [1] journal publication 1
  • [2] journal publication 2
  • [3] conference publication 1
  • [4] conference publication 2
  • [5] workshop publication 1

I'd like to turn it into something like:

  • [J1] journal publication 1
  • [J2] journal publication 2
  • [C3] conference publication 1
  • [C4] conference publication 2
  • [W5] workshop publication 1

Of course the same keys would appear in the reference list and in the text.

I could not find any easy way to do that with LaTeX/BibTeX. Do you have any suggestions?

Best Answer

Here's a solution using biblatex. (There are possibly more elegant ways to define the new \typeprefix macro.)

\documentclass{article}

\usepackage{biblatex}

\newcommand*{\typeprefix}{%
  \ifentrytype{article}{%
    A%
  }{%
    \ifentrytype{book}{%
      B%
    }{%
      O% "other"
    }%
  }%
}

\DeclareFieldFormat{labelnumber}{\typeprefix #1}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  journaltitle ={Journal Title},
}
@book{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
  publisher = {Publisher},
  location = {Location},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Some text \autocite{A01,B02,C03}.

\printbibliography

\end{document}

enter image description here

Related Question