Make each title in LaTeX bibliography references link to google search of that title

Alec Jacobson

August 02, 2012

weblog/

When ever I'm reading a new paper I'm constantly looking up the articles referenced in the bibliography. Sometimes bibliographies have links or urls but there so often dead or domain restricted. Instead, my modus operandi is to just google search the title and click on the first PDF that comes up in the results. To cut down on the steps I thought it would be nice if the PDF of the article I'm reading already had the google search set up for me. Then the title in the reference could be a link to a google search of itself. Here's a bibtex .bst function that can be modded into the acmsiggraph.bst file. Just replace:
FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$ }
  if$
}
with:
INTEGERS{ l }
FUNCTION{ string.length }
{ 
  #1 'l := 
  {duplicate$ duplicate$ #1 l substring$ = not}
    {l #1 + 'l :=}
  while$
  pop$ l
}

STRINGS{replace find text}
INTEGERS{find_length}
FUNCTION{find.replace}
{ 'replace :=
  'find :=
  'text :=
  find string.length 'find_length :=
  ""
    { text empty$ not }
    { text #1 find_length substring$ find =
        { 
          replace *
          text #1 find_length + global.max$ substring$ 'text :=
        }   
        { text #1 #1 substring$ *
          text #2 global.max$ substring$ 'text :=
        }         
      if$       
    }         
  while$    
}         


FUNCTION {google}
{ duplicate$ empty$
    { pop$ "" }
    { "{\href{http://www.google.com/search?q=" swap$ duplicate$ " " "+"
    find.replace "}" "" find.replace "{" "" find.replace "\" "" find.replace
    "$" "" find.replace "^" "" find.replace swap$ "}{" swap$ "}}" * * * *}
  if$
}

FUNCTION {format.title}
{ title empty$
    { "" }
    { title "t" change.case$ google}
  if$
}
I'm reposting all my papers with these links: Check it out Update: You may want to be sure to set up your external links to be non-colored:
\hypersetup{colorlinks,linkcolor=blue,urlcolor=}