Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to do amsalpha style citation with BibTeX, except that I want to have manual control over the key/labels (e.g., [ABC09]). Is there an option for this?

share|improve this question
Welcome to TeX.SX! Can you give a small example, with a sample of a bib entry and what you really need to do? – egreg Sep 21 '12 at 8:42

1 Answer

One of the optional fields of a BibTeX entry is key which is used for put in alphabetical order, cross-references and as label when the author or editor information is not available. Thus one can use the key field for the value of records for which one wants to manually control the label.

To this end one has to modify the amsalpha.bst, in particular the FUNCTION {output.bibitem}. (Please create a copy of amsalpha.bst and change the name to it, let us say myamsalpha.bst) This function can be modified as follows

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  key empty$
    {label write$}
    {key write$}
  if$
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

Then, you can use it as follows:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{first,
  author = "Last, First",
  title = "First Title",
  journal = "Journal Name",
  year = 2012
}
@Article{second,
  key = {ABC12},
  author = "Last, First",
  title = "Second Title",
  journal = "Journal Name",
  year = 2011
}
@Article{third,
  author = "More, First",
  title = "Third Title",
  journal = "Journal Name",
  year = 2011
}
\end{filecontents}
\begin{document}
Testing citations
\cite{first} 
\cite{second}
\cite{third}

\bibliographystyle{amsalpha}
\bibliography{\jobname}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.