TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using apalile-url.bst to get APA references formatting, but I want to format the reference link when I am using a URL, for example when I reference a URL I get.

this is a url reference [StackExchange, ], this is a book reference [Jones, 2001]

As you can see if the URL does not have a year it still uses the [name,year] format, but I want the link to the reference to look like

this is a url reference [StackExchange], this is a book reference [Jones, 2001]

Any ideas on how can I modify the .bst file?

EDIT: added working example




This shows the url \cite{google}



refdatabasewok is

  author = {Google},
  title = {Google},
  url = {https://www.google.com}
share|improve this question
What packages are you using to manage the references? Please add a minimal working example (MWE). – Guido Oct 12 '12 at 21:21
up vote 2 down vote accepted

The part to modify in the opaline-url.bst file is the function FUNCTION {calculable}. IN my copy of the file starts at line 1137. The function must be modified as follows:

FUNCTION {calc.label}
{ type$ "book" =
  type$ "inbook" =
    { type$ "proceedings" =
  year empty$  % add this line
    {""}       % add this line
    {", "}     % add this line
    if$        % add this line
  % ", "       % this is the original line that has to be removed or commented out
  year field.or.null purify$ #-1 #4 substring$    
  'label :=

The original style inserts ", ", what you have to do is to insert it only if there is a value for year. So you can create a conditional that checks whether there is a value for the year: year empty$ and if there is no value it does not insert anything, and it insert the comma and a space after it, i.e, ", ", if there is a year.

Change the name of the .bst file after you modified it.

share|improve this answer
Worked after changing the name a few times – aljndrrr Oct 15 '12 at 0:12

Your Answer


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.