Skip to content
A tool to pull latex document reference from ADS
Python TeX
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README
adstex.py
apikey
customcitationformat
example.tex

README

adsTeX (c) Tom Hands 2015 - tom.hands@le.ac.uk
================================================
ADSTeX is a utility that looks in LaTeX documents for citations, then searches
the NASA ADS database for matching papers, and outputs a .bbl (or bib) file
with your completed bibliography in. It's super-super alpha right now (as of
writing this I've done maybe 6 hours work on it), but you can try running it
on the example.tex file to see what it does. And please excuse the messy code
- I wrote this in the middle of job applications, so good python practice
wasn't the first thing on my mind...

First thing: you're going to need an ADS API key. This key lets adsTeX access
the ADS API to do searches for citations. Go to the new ADS beta
(https://ui.adsabs.harvard.edu) and sign up. Then follow this link to get your
API key: https://ui.adsabs.harvard.edu/#user/settings/token. Now replace the
contents of the file "apikey" in the adstex directory with your key.

To compile the example document:
- You'll need python3.0 or above
- In the adstex directory, run 
> latex example
- Now run
> python3 adstex.py example
to generate a bibliography
- Re run latex twice to generate a final document.

If you prefer to use BiBTex, adsTeX can generate a .bib file for you. Just run
adsTeX in this way:
> python3 adstex.py example bibtex
and it will generate a .bib file.

That's it for now. If using in your own document, either of the following citation styles will work:

\cite{ASurnameBSurname2015JRNL}
Where A is the first initial of Author A, B is the first initial of Author B,
2015 is the year and JRNL is the ADS abbreviation of the journal name
(eg. MNRAS, ApJ). You can skip the first initials and/or journal code entirely
if you like, as long as each separate surname starts with a capital
letter. Look in example.tex for more examples and pick a style you like. Do
bear in mind that searches may sometimes be degenerate and the script will
warn you of this - always check you are referencing the correct paper!

If your citation is degenerate, the script will let you know what the other
options are and how to cite them. For instabnce, attempting to cite the paper AGualandris2012MNRAS will throw a
warning and suggest that you may have meant the alternative citation,
AGualandris2012MNRAS1. Simply replace your \cite{AGualandris2012MNRAS} with
\cite{AGualandris2012MNRAS1} and you'll be referencing the other paper. Though do bear in mind that you can often break
degeneracy by specifying more authors.

If you want to avoid degeneracy altogether, you can always cite the ADS ID: 
\cite{2014MNRAS.445.2285D}
Where the number can be any one of the hugely long ADS IDs.

The format of bibliography items is currently provided in the file
"customcitationformat". This is identical to the format documented on the ADS
website here:
http://doc.adsabs.harvard.edu/abs_doc/help_pages/customformat.html , so you
can construct your own format with ease.

The journal codes seem to be a little hard to come by, so
I'll keep a list below of ones I've found:
- Astronomy & Astrophysics - A&A
- MNRAS - MNRAS (Obviously)
- IAU Symposium - IAUS
- ApJ
- Natur - Nature

Have fun!

You can’t perform that action at this time.