[Tex/LaTex] Bibliography with hyperlinks in same style as AJ

bibliographieshyperref

In Astronomical Journal articles I see bibliography styles, which include a pink DOI link and a blue NASA ADS link.

Example: See the figure.

enter image description here

Image source: http://iopscience.iop.org/article/10.3847/0004-6256/151/2/22/pdf

What needs to be done to reproduce this bibliography in my own latex document?

Best Answer

I think you'll have to modify the aasjournal.bst file to do something like this.

This solution gives almost the same as what you want. It only hyperlinks the volume, not the volume and pages. You can do this, but have to change a bit more.

Here's a patch file which you can use to make a new bst file. Save it as aasjournal.bst.patch then patch it as follows (linux commands):

$ cp aasjournal.bst aasjournal-hyperref.bst
$ patch aasjournal-hyperref.ast < aasjournal.bst.patch

aasjournal.st.patch

--- aasjournal.bst  2017-12-23 20:38:13.024114255 +1030
+++ aasjournal-hyperref.bst 2017-12-23 22:25:45.078409327 +1030
@@ -148,6 +148,7 @@
     year
     version
     url
+    adsurl
   }
   {}
   { label extra.label sort.label short.list }
@@ -1147,6 +1148,30 @@
     if$
 }

+%%%%%%% Custom href Functions
+
+FUNCTION {format.journal}
+{ journal empty$
+    { "" }
+    { doi empty$
+        { journal }
+        { "\href{http://dx.doi.org/" doi * "}{\color{magenta}" * journal * "}" * }
+      if$
+    }
+  if$
+}
+
+FUNCTION {format.vol}
+{ volume empty$
+    { "" }
+    { adsurl empty$
+        { volume }
+        { "\href{" adsurl * "}{\color{cyan}" * volume * "}" * }
+      if$
+    }
+  if$
+}
+
 %%%%%%%  End of functions from astrobib

 FUNCTION {article}
@@ -1157,9 +1182,8 @@
   format.date "year" output.check
   date.block
   crossref missing$
-    { journal
-      "journal" output.check
-      format.vol.num.pages output
+    { format.journal output
+      format.vol output
     }
     { format.article.crossref output.nonnull
       format.pages output

MWE

The bib entries are taken from the URLs.

\documentclass{aastex61}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{2011ApJ...738...13B,
   author = {{Batygin}, K. and {Brown}, M.~E. and {Fraser}, W.~C.},
    title = "{Retention of a Primordial Cold Classical Kuiper Belt in an Instability-Driven Model of Solar System Formation}",
  journal = {\apj},
archivePrefix = "arXiv",
   eprint = {1106.0937},
 primaryClass = "astro-ph.EP",
 keywords = {Kuiper belt: general, planets and satellites: dynamical evolution and stability, methods: analytical, methods: numerical},
     year = 2011,
    month = sep,
   volume = 738,
      eid = {13},
    pages = {13},
      doi = {10.1088/0004-637X/738/1/13},
   adsurl = {http://adsabs.harvard.edu/abs/2011ApJ...738...13B},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
@ARTICLE{2013A&A...556A..28B,
   author = {{Batygin}, K. and {Morbidelli}, A.},
    title = "{Analytical treatment of planetary resonances}",
  journal = {\aap},
archivePrefix = "arXiv",
   eprint = {1305.6513},
 primaryClass = "astro-ph.EP",
 keywords = {celestial mechanics, planets and satellites: dynamical evolution and stability, chaos},
     year = 2013,
    month = aug,
   volume = 556,
      eid = {A28},
    pages = {A28},
      doi = {10.1051/0004-6361/201220907},
   adsurl = {http://adsabs.harvard.edu/abs/2013A%26A...556A..28B},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{aasjournal-hyperref}
\bibliography{\jobname.bib}
\end{document}

enter image description here