{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Managing citations in the IPython Notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The IPython Notebook has the ability to work with LaTeX citations. This capability consists of a couple of different parts." ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Citing references in Markdown cells" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To cite LaTeX references in Markdown cells, use HTML data attributes to specify the LaTeX cite key. Here is an example of what you would type into a Markdown cell:\n", "\n", " (Granger, 2013)\n", "\n", "\n", "This uses a standard HTML tag, in this case `cite`, along with the `data-cite` attribute. The value of this attribute is the LaTeX citation key. You are not limited to using the `cite` HTML tag for this; you can use any valid HTML tag with the `data-cite` attribute. This flexibility allows you to style these citations in Markdown in any way you want. So the following is also valid:\n", "\n", " (Granger, 2013)\n" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Adding bibliography information to your LaTeX document" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In order for LaTeX/BibTeX to resolve your citations, you have to specify the actual bibliography entries. The best way of doing that is using BibTeX, but you can also enter a bibliography manually using `bibitem`. We have created a special `bibliography` block in the `nbconvert` templates for this purpose. Here is how you would use that block to declare your bibliography:\n", "\n", " ((*- extends 'latex_article.tplx' -*))\n", " \n", " ((* block bibliography *))\n", " \\bibliographystyle{unsrt}\n", " \\bibliography{ipython}\n", " ((* endblock bibliography *))\n", "\n", "This assumes that we have the file `ipython.bib` in the current working directory with our bibliography entries." ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Running nbconvert" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The last step is to run `nbconvert` to generate the PDF document using pdflatex and bibtex. Here is an example of how you would tell `nbconvert` to generate LaTeX output using your custom template and run pdflatex/bibtex to generate the PDF:\n", "\n", " ipython nbconvert --to latex --template mytemplate.tplx --post pdf mynotebook.ipynb\n" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This directory contains a full working example that can be run by typing:\n", "\n", " ipython nbconvert\n", "\n", "The setup for this example is contained in the config file `ipython_nbconvert_config.py`." ] } ], "metadata": {} } ] }