Notes with sphinx

Notes from conferences, minutes from a teleconf, ideas, etc.

Set up docs directory and conf.py (see other post).

Add math support, to array ‘extension’ in conf.py, e.g. ‘sphinx.ext.pngmath’. Looks like

extensions = [
‘sphinx.ext.autodoc’,
‘sphinx.ext.viewcode’,
‘sphinx.ext.pngmath’
]

Edit index.rst.

E.g.

***********
Conferences
***********

XXL

.. toctree::
:maxdepth: 4

Mljet 2015

Euclid

.. toctree::
:maxdepth: 4

Lausanne 2015

One rst file for each meeting. E.g. euclid-lausanne-2015.rst:

*****
Talks
*****

Tuesday
=======

Jarle Brinchmann, legacy
————————

WGs

Large number of WG (Milky Way, AGN, local Universe, extra-solar planets,
strong lensing, theory, cosmological simulations, SN + transients, galaxy
clusters, primeval universe)

**********
References
**********

.. bibliography:: astro.bib
:cited:
:style: mystyle
:encoding: utf

astro.bib is bibtex file
:cited: only display cited references (other option :all:)
:style: see conf.py
encoding: utf, do not interpolate any latex special characters. Necessary if ‘%’ in url links, but
annoying for math mode in titles, LaTeX accents in names etc.

Need to add missing abbreviations to bibtex file, e.g.:

@string{apjs = “APJS”}

Further problems:
– missing title
– missing booktitle
– missing journal
pages = {3-}, needs to be {3-+} [error message does not show line in bibtex file!]

make html or make latexpdf
can take a long time for long (several hundred) bib entries.

conf.py:

# pybtex code following:
# http://bazaar.launchpad.net/~pybtex-devs/pybtex/trunk/view/head:/pybtex/style/formatting/unsrt.py
# and
# http://sphinxcontrib-bibtex.readthedocs.org/en/latest/usage.html

from pybtex.style.formatting.unsrt import Style
# Other styles: alpha, plain, unsrtalpha
from pybtex.style.template import (
join, field, optional, sentence, href )
from pybtex.plugin import register_plugin

class MyStyle(Style):

def format_web_refs(self, e):
# based on urlbst output.web.refs
# Adds adsurl with link
return sentence(capfirst=False) [
optional [ self.format_url(e) ],
optional [ self.format_adsurl(e) ],
optional [ self.format_eprint(e) ],
optional [ self.format_pubmed(e) ],
optional [ self.format_doi(e) ],
]

def format_url(self, e):
# based on urlbst format.url
return href [
field(‘url’),
‘url’
]

def format_adsurl(self, e):
# based on urlbst format.url
return href [
field(‘adsurl’),
‘ads link’
]

register_plugin(‘pybtex.style.formatting’, ‘mystyle’, MyStyle)

‘sphinxcontrib.bibtex’,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s