44

Normally, I'm basically OK with BibTeX's choice of citation key (by which I mean, the short symbol it shows in the final document, like [2] or [Hil05], not the one one types in the tex file), but every once in a while there's a paper that cries out for a particular key (such as the paper of Freyd, Hoste, Lickorish, Millet, Ocneano and Yetter in which the HOMFLY polynomial is defined clearly should have the key [HOMFLY], not [FHL+95]), or BibTeX picks a particularly bad one.

In these cases, is there a field one can insert into the bibtex entry to override the key choice, or something one can do other than editing the .bbl file?

28

Using biblatex, you may add the shorthand field:

\documentclass{article}

\usepackage[style=alphabetic]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  shorthand = {Author},
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

enter image description here

14

If you use the natbib package, you can declare an "alias" or alternative citation for a source:

For example, the following .bib entry:

@techreport{caltrans2002,
    Author = {{California Department of Transportation}},
    Title = {{Humboldt Bay Bridges Seismic Substructure Retrofit Environmental  Assessment/Finding of No Significant Impact (EA/FONSI)}},
    Year = {2002}}

Produces the following output when \citep{caltrans2002} used in a document:


Example citation without alias.


Having a citation that spans most of a line can be pretty bothersome- especially when the full name has to appear in the bibliography but there is a nice shorthand that should be used when citing in the text. By including \usepackage{natbib} in your preamble, you have access to citation aliases:

\defcitealias{caltrans2002}{\scshape CalTrans, 2002}

Then using \citepalias{caltrans2002} instead of \citep{caltrans2002} produces the following output:


Example citation using an alias.


In both cases, the associated entry in the bibliography looks like this:


Example bibliography text.


The LaTeX and BibTeX source I used to create this example can be obtained from GitHub.

  • Is there a way to use an alias w/multiple citations, i.e., in a situation where one would use \citep[][]{key1,key2,...,keyN? – thomp45793 Jan 20 '17 at 3:49
9

There's actually a pretty good answer over at Stack Overflow: Is there a way to override a bibtex style file for a particular entry?.

The fact that the programming language BibTeX style files (.bst) are written in is called BAFLL may alert you to the fact that this sort of problem is a pain to deal with.

5

Alternatively, you can modify your .bbl file by hand. You could even use sed to automatically make the desired change after each time you regenerate the .bbl file using BibTeX --- I can show you the details if you like (ask a new question?).

  • 5
    Just edit the sed-fu into this answer. – Phil Miller Jul 27 '10 at 1:03
  • I don't see how this is possible; a bibtex produced .bbl file contains nothing at all about (shorthand) cite labels; see e.g. tex.stackexchange.com/questions/154215/… ... if you meant changes in the .bst, that is something else altogether. – sdaau Sep 5 '14 at 20:26
1

If you want to avoid using natbib and biblatex (sometimes I have compilation issues with these packages), you can simple use the abstract style, as it uses they bibtex keys as cite keys. This was pointed out by this answer.


Alternatively, this is also addressed by this alternative_answer, however it involves more steps:

1) download this style: http://ftp.math.utah.edu/pub/tex/bibtex/alpha.bst

2) place it in your project's directory, preferentially under a different name (e.g. keystyle.bst).

3) in the file, replace the output.bibitem entry to:

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

This answer

  • 1
    With biblatex you use no bst file. Can you add an MWE please (best!) or explain with own words how that should work? – Mensch Jan 30 '16 at 14:18
  • I know that biblatex does not use bst file. The solution that I presented is for NOT using biblatex nor natbib. Maybe I should edit the answer to make it more clear. Do you wish a MWE for the proposed solution? – João Matos Jan 30 '16 at 14:24
0

I also had to avoid natbib and biblatex as I was already given a template which had thesis_style.bst by Patrick W. Daly based on alpha.bst.

It already had support for the key field in bibtex entries, but the key was used as citation label only in case author was empty. I modified the following code

FUNCTION {author.key.label}
{ key empty$
    { author empty$
        { cite$ #1 #3 substring$ }
        { author format.lab.names }
      if$
    }
    { key #3 text.prefix$ }
  if$
}
%{ author empty$
%    { key empty$
%        { cite$ #1 #3 substring$ }
%        { key #3 text.prefix$ }
%      if$
%    }
%    { author format.lab.names }
%  if$
%}

which makes it first prefer the key field and only then the author.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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