Take the 2-minute tour ×
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 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

\documentclass[letterpaper,12pt,oneside,onecolumn,final,openany]{report}
\usepackage{url}

\begin{document}

\chapter{Test}

This shows the url \cite{google}


\clearpage
\addcontentsline{toc}{chapter}{References}
\bibliographystyle{./reference/apalike-url}
\bibliography{./reference/refdatabasewok}

\end{document}

refdatabasewok is

@ELECTRONIC{google,
  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

1 Answer 1

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" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
    'editor.key.label           
    'author.key.label           
      if$
    }
  if$ 
  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

 
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.