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}

1 Answer 1


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.

  • Worked after changing the name a few times
    – aljndrrr
    Oct 15, 2012 at 0:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .