{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Jupyter Notebook Users Manual\n", "\n", "This page describes the functionality of the [Jupyter](http://jupyter.org) electronic document system. Jupyter documents are called \"notebooks\" and can be seen as many things at once. For example, notebooks allow:\n", "\n", "* creation in a **standard web browser**\n", "* direct **sharing**\n", "* using **text with styles** (such as italics and titles) to be explicitly marked using a [wikitext language](http://en.wikipedia.org/wiki/Wiki_markup)\n", "* easy creation and display of beautiful **equations**\n", "* creation and execution of interactive embedded **computer programs**\n", "* easy creation and display of **interactive visualizations**\n", "\n", "Jupyter notebooks (previously called \"IPython notebooks\") are thus interesting and useful to different groups of people:\n", "\n", "* readers who want to view and execute computer programs\n", "* authors who want to create executable documents or documents with visualizations\n", "\n", "
\n", "#Header 1\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#Header 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And if I type \"##Header 2\" (at the beginning of a cell), this notebook will turn that input into another output:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "##Header 2\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Header 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In these examples, the hashtags are markers which tell the Notebook how to typeset the text. There are many markup languages, but one family, or perhaps guiding philosophy, of markup languages is called \"Markdown,\" named somewhat jokingly for its simplicity. Your Notebook uses \"marked,\" a Markdown library of typeset and other formatting instructions, like the hashtags in the examples above.\n", "\n", "Markdown is a markup language that generates HTML, which the cell can interpret and render. This means that Markdown Cells can also render plain HTML code. If you're interested in learning HTML, check out this [helpful online tutorial][html tutorial].\n", "\n", "[html tutorial]: http://www.w3schools.com/html/ \"w3schools.com HTML Tutorial\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Why Use Markdown (and not a WYSIWYG)?**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Why is Markdown better? Well, it’s worth saying that maybe it isn't. Mainly, it’s not actually a question of better or worse, but of what’s in front of you and of who you are. A definitive answer depends on the user and on that user’s goals and experience. These Notebooks don't use Markdown because it's definitely better, but rather because it's different and thus encourages users to think about their work differently. \n", "\n", "It is very important for computer science students to learn how to conceptualize input and output as dependent, but also distinct. One good reason to use Markdown is that it encourages this kind of thinking. Relatedly, it might also promote focus on substance over surface aesthetic. Markdown is somewhat limited in its style options, which means that there are inherently fewer non-subject-specific concerns to agonize over while working. It is the conceit of this philosophy that you would, by using Markdown and this Notebook, begin to think of the specific stylistic rendering of your cells as distinct from what you type into those same cells, and thus also think of the content of your writing as necessarily separate from its formating and appearance. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.1 Block Elements" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.1 Paragraph Breaks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Paragraphs consist of one or more consecutive lines of text and they are separated by one or more blank lines. If a line contains only spaces, it is a blank line." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.2 Line Breaks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.2.1 Hard-Wrapping and Soft-Wrapping" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you're used to word processing software, you've been writing with automatically hard-wrapped lines and paragraphs. In a hard-wrapped paragraph the line breaks are not dependent on the size of the viewing window. If you click and drag your mouse to expand a word processing document, for example, the shape of the paragraphs and the length of the lines will not change. In other words, the length of a hard-wrapped line is determined either by the number of words in the line (in the case of word processing software where this number is predetermined and the program wraps for the user automatically), or individual intention (when a user manually presses an Enter or Return key to control exactly how long a line is).\n", "\n", "Soft-wrapped paragraphs and lines, however, *do* depend on the size of their viewing window. If you increase the size of a window where soft-wrapped paragraphs are displayed, they too will expand into longer lines, becoming shorter and wider to fill the increased window space horizontally. Unsurprising, then, if you *narrow* a window, soft-wrapped lines will shrink and the paragraphs will become longer vertically. \n", "\n", "Markdown, unlike most word processing software, does not automatically hard-wrap. If you want your paragraphs to have a particular or deliberate shape and size, you must insert your own break by ending the line with two spaces and then typing Return.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.2.2 Soft-Wrapping" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.2.3 Hard-Wrapping" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah blah blah \n", "blah blah blah blah blah \n", "blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah blah blah blah blah \n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah blah blah \n", "blah blah blah blah blah \n", "blah blah blah blah blah \n", "blah blah blah blah blah blah blah blah blah blah blah blah blah \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.3 Headers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "#Header 1\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#Header 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "##Header 2\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Header 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "###Header 3\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###Header 3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "####Header 4\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "####Header 4" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "#####Header 5\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#####Header 5" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "######Header 6\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "######Header 6" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.4 Block Quotes" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.4.1 Standard Block Quoting" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", ">blah blah block quote blah blah block quote blah blah block \n", "quote blah blah block quote blah blah block \n", "quote blah blah block quote blah blah block quote blah blah block quote\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ">blah blah block quote blah blah block quote blah blah block \n", "quote blah blah block quote blah blah block \n", "quote blah blah block quote blah blah block quote blah blah block quote" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note**: Block quotes work best if you intentionally hard-wrap the lines." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.4.2 Nested Block Quoting" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", ">blah blah block quote blah blah block quote blah blah block \n", "block quote blah blah block block quote blah blah block \n", ">>quote blah blah block quote blah blah \n", "block block quote blah blah block \n", ">>>quote blah blah block quote blah blah block quote blah blah block quote\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ">blah blah block quote blah blah block quote blah blah block \n", "block quote blah blah block block quote blah blah block \n", ">>quote blah blah block quote blah blah \n", "block block quote blah blah block \n", ">>>quote blah blah block quote blah blah block quote blah blah block quote" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.5 Lists" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.5.1 Ordered Lists" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In Markdown, you can list items using numbers, a **`+`**, a **` - `**, or a **`*`**. However, if the first item in a list or sublist is numbered, Markdown will interpret the entire list as ordered and will automatically number the items linearly, no matter what character you use to denote any given separate item." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "####Groceries:\n", "\n", "0. Fruit:\n", " 6. Pears\n", " 0. Peaches\n", " 3. Plums\n", " 4. Apples \n", " 2. Granny Smith \n", " 7. Gala\n", " * Oranges\n", " - Berries \n", " 8. Strawberries \n", " + Blueberries\n", " * Raspberries\n", " - Bananas\n", "9. Bread:\n", " 9. Whole Wheat\n", " 0. With oats on crust\n", " 0. Without oats on crust\n", " 0. Rye \n", " 0. White\n", "0. Dairy:\n", " 0. Milk\n", " 0. Whole\n", " 0. Skim\n", " 0. Cheese\n", " 0. Wisconsin Cheddar\n", " 0. Pepper Jack\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "####Groceries:\n", "\n", "0. Fruit:\n", " 6. Pears\n", " 0. Peaches\n", " 3. Plums\n", " 4. Apples \n", " 2. Granny Smith \n", " 7. Gala\n", " * Oranges\n", " - Berries \n", " 8. Strawberries \n", " + Blueberries\n", " * Raspberries\n", " - Bananas\n", "9. Bread:\n", " 9. Whole Wheat\n", " 0. With oats on crust\n", " 0. Without oats on crust\n", " 0. Rye \n", " 0. White\n", "0. Dairy:\n", " 0. Milk\n", " 0. Whole\n", " 0. Skim\n", " 0. Cheese\n", " 0. Wisconsin Cheddar\n", " 0. Pepper Jack" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.1.5.2 Bulleted Lists" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you begin your list or sublist with a **`+`**, a **` - `**, or a **`*`**, then Markdown will interpret the whole list as unordered and will use bullets regardless of the characters you type before any individual list item." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "####Groceries:\n", "\n", "* Fruit:\n", " * Pears\n", " 0. Peaches\n", " 3. Plums\n", " 4. Apples \n", " - Granny Smith \n", " 7. Gala\n", " * Oranges\n", " - Berries \n", " - Strawberries \n", " + Blueberries\n", " * Raspberries\n", " - Bananas\n", "9. Bread:\n", " * Whole Wheat\n", " * With oats on crust\n", " 0. Without oats on crust\n", " + Rye \n", " 0. White\n", "0. Dairy:\n", " * Milk\n", " + Whole\n", " 0. Skim\n", " - Cheese\n", " - Wisconsin Cheddar\n", " 0. Pepper Jack\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "####Groceries:\n", "\n", "* Fruit:\n", " * Pears\n", " 0. Peaches\n", " 3. Plums\n", " 4. Apples \n", " - Granny Smith \n", " 7. Gala\n", " * Oranges\n", " - Berries \n", " - Strawberries \n", " + Blueberries\n", " * Raspberries\n", " - Bananas\n", "9. Bread:\n", " * Whole Wheat\n", " * With oats on crust\n", " 0. Without oats on crust\n", " + Rye \n", " 0. White\n", "0. Dairy:\n", " * Milk\n", " + Whole\n", " 0. Skim\n", " - Cheese\n", " - Wisconsin Cheddar\n", " 0. Pepper Jack" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.1.6 Section Breaks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "___\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "___ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "***\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "***" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "* * *\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* * *" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "_ _ _\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "_ _ _" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "- - -\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- - -" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.2 Backslash Escape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "What happens if you want to include a literal character, like a **`#`**, that usually has a specific function in Markdown? Backslash Escape is a function that prevents Markdown from interpreting a character as an instruction, rather than as the character itself. It works like this:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\\# Wow, this isn't a header. \n", "# This is definitely a header.\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\\# Wow, this isn't a header. \n", "# This is definitely a header." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Markdown allows you to use a backslash to escape from the functions of the following characters:\n", "* \\ backslash\n", "* ` backtick\n", "* \\* asterisk\n", "* _ underscore\n", "* {} curly braces\n", "* [] square brackets\n", "* () parentheses\n", "* \\# hashtag\n", "* \\+ plus sign|\n", "* \\- minus sign (hyphen)\n", "* . dot\n", "* ! exclamation mark" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.3 Hyperlinks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.3.1 Automatic Links" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "http://en.wikipedia.org\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "http://en.wikipedia.org" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.3.2 Standard Links" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "[click this link](http://en.wikipedia.org)\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[click this link](http://en.wikipedia.org)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.3.3 Standard Links With Mouse-Over Titles" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "[click this link](http://en.wikipedia.org \"Wikipedia\")\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[click this link](http://en.wikipedia.org \"Wikipedia\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.3.4 Reference Links" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Suppose you are writing a document in which you intend to include many links. The format above is a little arduous and if you have to do it repeatedly *while* you're trying to focus on the content of what you're writing, it's going to be a really big pain. \n", "\n", "Fortunately, there is an alternative way to insert hyperlinks into your text, one where you indicate that there is a link, name that link, and then use the name to provide the actually URL later on when you're less in the writing zone. This method can be thought of as a \"reference-style\" link because it is similar to using in-text citations and then defining those citations later in a more detailed reference section or bibliography. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "This is [a reference] [identification tag for link]\n", "\n", "[identification tag for link]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is [a reference] [identification tag for link]\n", "\n", "[identification tag for link]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:** The \"identification tag for link\" can be anything. For example:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "This is [a reference] [lfskdhflhslgfh333676]\n", "\n", "[lfskdhflhslgfh333676]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is [a reference] [lfskdhflhslgfh333676]\n", "\n", "[lfskdhflhslgfh333676]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This means you can give your link an intuitive, easy to remember, and relevant ID:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "This is [a reference][Chile]\n", "\n", "[chile]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is [a reference][Chile]\n", "\n", "[chile]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note**: Link IDs are not case-sensitive." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you don't want to give your link an ID, you don't have to. As a short cut, Markdown will understand if you just use the words in the first set of brackets to define the link later on. This works in the following way:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "This is [a reference][]\n", "\n", "[a reference]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is [a reference][]\n", "\n", "[a reference]: http://en.wikipedia.org/wiki/Chile \"Wikipedia Article About Chile\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Another really helpful feature of a reference-style link is that you can define the link anywhere in the cell. (must be in the cell) For example:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "This is [a reference] [ref] blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n", "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
\n", "[Here's a link to the section of Automatic Section Numbering](#Automatic-Section-Numbering)\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Here's a link to the section of Automatic Section Numbering](#2.4.2.1-Automatic-Section-Numbering)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.3.5.2 Standard Notebook-Internal Links With Mouse-Over Titles" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "[Here's a link to the section on lists](#Lists \"Lists\")\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Here's a link to the section of Automatic Section Numbering](#2.4.2.1-Automatic-Section-Numbering)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.3.5.3 Reference-Style Notebook-Internal Links" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "[Here's a link to the section on Table of Contents Support][TOC]\n", "\n", "[TOC]: #Table-of-Contents-Support\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Here's a link to the section on Table of Contents Support][TOC]\n", "\n", "[TOC]: #2.4.2.2-Table-of-Contents-Support" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.4 Tables" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In Markdown, you can make a table by using vertical bars and dashes to define the cell and header borders:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "|Header|Header|Header|Header|\n", "|------|------|------|------|\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "|Header|Header|Header|Header|\n", "|------|------|------|------|\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n", "|Cell |Cell |Cell | Cell |\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Making a table this way might be especially useful if you want your document to be legible both rendered and unrendered. However, you don't *need* to include all of those dashes, vertical bars, and spaces for Markdown to understand that you're making a table. Here's the bare minimum you would need to create the table above: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Header|Header|Header|Header\n", "-|-|-|-\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Header|Header|Header|Header\n", "-|-|-|-\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n", "Cell|Cell|Cell|Cell\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It's important to note that the second line of dashes and vertical bars is essential. If you have just the line of headers and the second line of dashes and vertical bars, that's enough for Markdown to make a table. \n", "\n", "Another important formatting issue has to do with the vertical bars that define the left and right edges of the table. If you include all the vertical bars on the far left and right of the table, like in the first example above, Markdown will ignore them completely. *But*, if you leave out some and include others, Markdown will interpret any extra vertical bar as an additional cell on the side that the bar appears in the unrendered version of the text. This also means that if you include the far left or right vertical bar in the second line of bars and dashes, you must include all of the otherwise optional vertical bars (like in the first example above)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.4.1 Cell Justification" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If not otherwise specified the text in each header and cell of a table will justify to the left. If, however, you wish to specify either right justification or centering, you may do so like this: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "**Centered, Right-Justified, and Regular Cells and Headers**:\n", "\n", "centered header | regular header | right-justified header | centered header | regular header \n", ":-:|-|-:|:-:|-\n", "centered cell|regular cell|right-justified cell|centered cell|regular cell\n", "centered cell|regular cell|right-justified cell|centered cell|regular cell\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Centered, Right-Justified, and Regular Cells and Headers**:\n", "\n", "centered header | regular header | right-justified header | centered header | regular header \n", ":-:|-|-:|:-:|-\n", "centered cell|regular cell|right-justified cell|centered cell|regular cell\n", "centered cell|regular cell|right-justified cell|centered cell|regular cell\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "While it is difficult to see that the headers are differently justified from one another, this is just because the longest line of characters in any column defines the width of the headers and cells in that column. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:** You cannot make tables directly beneath a line of text. You must put a blank line between the end of a paragraph and the beginning of a table. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.5 Style and Emphasis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "*Italics*\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Italics*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "_Italics_\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "_Italics_" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "**Bold**\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Bold**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "__Bold__\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__Bold__" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:** If you want actual asterisks or underscores to appear in your text, you can use the [backslash escape function] [backslash] like this:\n", "\n", "[backslash]: #4.2-Backslash-Escape \"Backslash Escape\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "\\*awesome asterisks\\* and \\_incredible under scores\\_\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\\*awesome asterisks\\* and \\_incredible under scores\\_" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.6 Other Characters" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "Ampersand & Ampersand\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Ampersand & Ampersand" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "< angle brackets >\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "< angle brackets >" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "" quotes " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" quotes " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.7 Including Code Examples" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want to signify that a particular section of text is actually an example of code, you can use backquotes to surround the code example. These will switch the font to monospace, which creates a clear visual formatting difference between the text that is meant to be code and the text that isn't. \n", "\n", "Code can either in the middle of a paragraph, or as a block. Use a single backquote to start and stop code in the middle of a paragraph. Here's an example:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "The word `monospace` will appear in a code-like form.\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The word `monospace` will appear in a code-like form." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:** If you want to include a literal backquote in your code example you must suround the whole text block in double backquotes like this: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "`` Look at this literal backquote ` ``\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`` Look at this literal backquote ` ``" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To include a complete code-block inside a Markdown cell, use triple backquotes. Optionally, you can put the name of the language that you are quoting after the starting triple backquotes, like this:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "```python\n", "def function(n):\n", " return n + 1\n", "```\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That will format the code-block (sometimes called \"fenced code\") with syntax coloring. The above code block will be rendered like this:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```python\n", "def function(n):\n", " return n + 1\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The language formatting names that you can currently use after the triple backquote are:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "apl django go jinja2 ntriples q smalltalk toml\n", "asterisk dtd groovy julia octave r smarty turtle\n", "clike dylan haml less pascal rpm smartymixed vb\n", "clojure ecl haskell livescript pegjs rst solr vbscript\n", "cobol eiffel haxe lua perl ruby sparql velocity\n", "coffeescript erlang htmlembedded markdown php rust sql verilog\n", "commonlisp fortran htmlmixed pig sass stex xml\n", "css gas http mirc properties scheme tcl xquery\n", "d gfm jade mllike puppet shell tiddlywiki yaml\n", "diff gherkin javascript nginx python sieve tiki z80\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.8 Images" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.8.1 Images from the Internet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Inserting an image from the internet is almost identical to inserting a link. You just also type a **`!`** before the first set of brackets:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Note:** Unlike with a link, the words that you type in the first set of brackets do not appear when they are rendered into html by Markdown. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 4.8.1.1 Reference-Style Images from the Internet" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Just like with links, you can also use a reference-style format when inserting images from the internet. This involves indicating where you want to place a picture, giving that picture an ID tag, and then later defining that ID tag. The process is nearly identical to using the reference-style format to insert a link:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "![][giraffe]\n", "\n", "[giraffe]:http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/South_African_Giraffe,_head.jpg/877px-South_African_Giraffe,_head.jpg \"Picture of a Giraffe\"\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![][giraffe]\n", "\n", "[giraffe]: http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/South_African_Giraffe,_head.jpg/877px-South_African_Giraffe,_head.jpg \"Picture of a Giraffe\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.9 LaTeX Math" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Jupyter Notebooks' Markdown cells support LateX for formatting mathematical equations. To tell Markdown to interpret your text as LaTex, surround your input with dollar signs like this:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "$z=\\dfrac{2x}{3y}$\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$z=\\dfrac{2x}{3y}$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An equation can be very complex:\n", "\n", "\n", "$F(k) = \\int_{-\\infty}^{\\infty} f(x) e^{2\\pi i k} dx$\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$F(k) = \\int_{-\\infty}^{\\infty} f(x) e^{2\\pi i k} dx$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you want your LaTex equations to be indented towards the center of the cell, surround your input with two dollar signs on each side like this: " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "$$2x+3y=z$$\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$$2x+3y=z$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For a comprehensive guide to the mathematical symbols and notations supported by Jupyter Notebooks' Markdown cells, check out [Martin Keefe's helpful reference materials on the subject][mkeefe].\n", "\n", "[mkeefe]: http://martinkeefe.com/math/mathjax1 \"Martin Keefe's MathJax Guide\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 5. Bibliographic Support" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Bibliographic Support makes managing references and citations in your Notebook much easier, by automating some of the bibliographic process every person goes through when doing research or writing in an academic context. There are essentially three steps to this process for which your Notebook's Bibliographic support can assist: gathering and organizing sources you intend to use, citing those sources within the text you are writing, and compiling all of the material you referenced in an organized, correctly formatted list, the kind which usually appears at the end of a paper in a section titled \"References,\" \"Bibliography,\" or \"Works Cited. \n", "\n", "In order to benefit from this functionality, you need to do two things while writing your paper: first, you need to create a [Bibtex database][bibdb] of information about your sources and second, you must use the the [cite command][cc] in your Markdown writing cells to indicate where you want in-text citations to appear.\n", "\n", "If you do both these things, the \"Generate References\" button will be able to do its job by replacing all of your cite commands with validly formatted in-text citations and creating a References section at the end of your document, which will only ever include the works you specifically cited within in your Notebook. \n", "\n", "**Note:** References are generated without a header cell, just a [markdown header][]. This means that if you want a References section to appear in your table of contents, you will have to unrender the References cell, delete the \"References\" header, make a Header Cell of the appropriate level and title it \"References\" yourself, and then generate a table of contents using [Table of Contents Support][table of contents]. This way, you can also title your References section \"Bibliography\" or \"Works Cited,\" if you want.\n", "\n", "[markdown header]: #4.1.3-Headers\n", "[table of contents]: #2.4.2.2-Table-of-Contents-Support\n", "[bibdb]: #5.1-Creating-a-Bibtex-Database\n", "[cc]:#5.2-Cite-Commands-and-Citation-IDs\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5.1 Creating a Bibtex Database" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Bibtex is reference management software for formatting lists of references ([from Wikipedia](BibTeX is reference management software for formatting lists of references \"Wikipedia Article On Bibtex\")). While your Notebook does not use the Bibtex software, it does use [Bibtex formatting](#5.1.3-Formatting-Bibtex-Entries) for creating references within your Bibliographic database.\n", "\n", "In order for the Generate References button to work, you need a bibliographic database for it to search and match up with the sources you've indicated you want to credit using [cite commands and citation IDs](#5.2-Cite-Commands-and-Citation-IDs).\n", "\n", "When creating a bibliographic database for your Notebook, you have two options: you can make an external database, which will exist in a separate Notebook from the one you are writing in, or you can make an internal database which will exist in a single cell inside the Notebook in which you are writing. Below are explanations of how to use these database creation strategies, as well as a discussion of the pros and cons for each. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5.1.1 External Bibliographic Databases" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To create an external bibliographic database, you will need to create a new Notebook and title it **`Bibliography`** in the toplevel folder of your current Jupyter session. As long as you do not also have an internal bibliographic database, when you click the Generate References button your Notebook's Bibliographic Support will search this other **`Bibliography`** Notebook for Bibtex entries. Bibtex entries can be in any cell and in any kind of cell in your **`Bibliography`** Notebook as long as the cell begins with **``**. Go to [this section][bibfor] for examples of valid BibTex formatting.\n", "\n", "Not every cell has to contain BibTex entries for the external bibliographic database to work as intended with your Notebook's bibliographic support. This means you can use the same helpful organization features that you use in other Notebooks, like [Automatic Section Numbering][asn] and [Table of Contents Support][toc], to structure your own little library of references. The best part of this is that any Notebook containing validly formatted [cite commands][cc] can check your external database and find only the items that you have indicated you want to cite. So you only ever have to make the entry once and your external database can grow large and comprehensive over the course of your accademic writing career. \n", "\n", "There are several advantages to using an external database over [an internal one][internal database]. The biggest one, which has already been described, is that you will only ever need to create one and you can organize it into sections by using headers and generating [automatic section numbers][asn] and a [table of contents][toc]. These tools will help you to easily find the right [citation ID][cc] for a given source you want to cite. The other major advantage is that an external database is not visible when viewing the Notebook in which you are citing sources and generating a References list. Bibtex databases are not very attractive or readable and you probably won't want one to show up in your finished document. There are [ways to hide internal databases][hiding bibtex cell], but it's convenient not to have to worry about that. \n", "\n", "\n", "[asn]: #2.4.2.1-Automatic-Section-Numbering\n", "[toc]: #2.4.2.2-Table-of-Contents-Support\n", "[cc]: #5.2-Cite-Commands-and-Citation-IDs\n", "[hiding bibtex cell]: #5.1.2.1-Hiding-Your-Internal-Database\n", "[bibfor]:#5.1.3-Formatting-Bibtex-Entries" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5.1.2 Internal Bibliographic Databases" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Unlike [external bibliographic databases][exd], which are comprised from an entire separate notebook, internal bibliographic databases consist of only one cell within in the Notebook in which you are citing sources and compiling a References list. The single cell, like all of the many BibTex cells that can make up an external database, must begin with **``** in order to be validly formatted and correctly interpreted by your Notebook's Bibliographic Support. It's probably best to keep this cell at the very end or the very beginning of your Notebook so you always know where it is. This is because when you use an intenral bibliographic databse it can only consist of one cell. This means that if you want to cite multiple sources you will need to keep track of the single cell that comprises your entire internal bibliographic database during every step of the research and writing process. \n", "\n", "Internal bibliographic databases make more sense when your project is a small one and the list of total sources is short. This is especially convenient if you don't already have a built-up external database. With an internal database you don't have to create and organize a whole separate Notebook, a task that's only useful when you have to keep track of a lot of different material. Additionally, if you want to share your finished Notebook with others in a form that retains its structural validity, you only have to send one Notebook, as oppose to both the project itself and the Notebook that comprises your external bibliographic database. This is especially useful for a group project, where you want to give another reader the ability to edit, not simply read, your References section. \n", "\n", "[exd]:#5.1.1-External-Bibliographic-Databases\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 5.1.2.1 Hiding Your Internal Database" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Even though they have some advantages, especially for smaller projects, internal databases have on major draw back. They are not very attractive or polished looking and you probably won't want one to appear in your final product. Fortunately, there are two methods for hiding your internal biblioraphic database.\n", "\n", "While your Notebook's bibliographic support will be able to interpret [correctly formatted BibTex entries][bibfor] in any [kind of cell][cell kind], if you use a [Markdown Cell][md cell] to store your internal bibliographic database, then when you run the cell all of the ugly BibTex formatting will disappear. This is handy, but it also makes the cell very difficult to find, so remember to keep careful track of where your hidden BibTex databse is if you're planning to edit it later. If you want your final product to be viewed stably as HTML, then you can make your internal BibTex database inside a [Raw Cell][RC], use the [cell toolbar][] to select \"Raw Cell Format\", and then select \"None\" in the toolbar that appears in the corner of your Raw Cell BibTex database. This way, you will still be able to easily find and edit the database when you are working on your Notebook, but others won't be able to see the database when viewing your project in its final form. \n", "\n", "\n", "[cell toolbar]: #1.-Getting-to-Know-your-Jupyter-Notebook's-Toolbar\n", "[bibfor]:#5.1.3-Formatting-Bibtex-Entries\n", "[RC]:#2.3-Raw-Cells\n", "[md cell]: #2.2-Markdown-Cells\n", "[cell kind]: #2.-Different-Kinds-of-Cells" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5.1.3 Formatting Bibtex Entries" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "BibTex entries consist of three crucial components: one, the type of source you are citing (a book, article, website, etc.); two, the unique [citation ID][cc] you wish to remember the source by; and three, the fields of information about that source (author, title of work, date of publication, etc.). Below is an example entry, with each of these three components designated clearly\n", "\n", "\n", "\n", "<!--bibtex\n", "\n", "@ENTRY TYPE{CITATION ID,\n", " FIELD 1 = {source specific information},\n", " FIELD 2 = {source specific informatio},\n", " FIEL 3 = {source specific informatio},\n", " FIELD 4 = {source specific informatio}\n", "}\n", "\n", "-->\n", "\n", "\n", "\n", "More comprehensive documentation of what entry types and corresponding sets of required and optional fields BibTex supports can be found in the [Wikipedia article on BibTex][wikibibt].\n", "\n", "Below is a section of the external bibliographic database for a fake history paper about the fictional island nation of Calico. (None of the entries contain information about real books or articles):\n", "\n", "[cc]: #5.2-Cite-Commands-and-Citation-IDs\n", "[wikibibt]: http://en.wikipedia.org/wiki/Markdown\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "<!--bibtex\n", "\n", "@book{wellfarecut,\n", " title = {Our Greatest Threat: The Rise of Anti-Wellfare Politics in Calico in the 21st Century},\n", " author = {Jacob, Bernadette},\n", " year = {2010},\n", " publisher = {Jupyter University Press}\n", "}\n", " \n", "@article{militaryex2,\n", " title = {Rethinking Calican Military Expansion for the New Century},\n", " author = {Collier, Brian F.},\n", " journal = {Modern Politics},\n", " volume = {60},\n", " issue = {25},\n", " pages = {35 - 70},\n", " year = {2012} \n", "}\n", "\n", "@article{militaryex1,\n", " title = {Conservative Majority Passes Budget to Grow Military},\n", " author = {Lane, Lois},\n", " journal = {The Daily Calican},\n", " month = {October 19th, 2011},\n", " pages = {15 - 17},\n", " year = {2011}\n", "}\n", "\n", "@article{oildrill,\n", " title = {Oil Drilling Off the Coast of Jupyter Approved for Early Next Year},\n", " author = {Marks, Meghan L.},\n", " journal = {The Python Gazette},\n", " month = {December 5th, 2012},\n", " pages = {8 - 9},\n", " year = {2012}\n", "}\n", "\n", "@article{rieseinterview,\n", " title = {Interview with Up and Coming Freshman Senator, Alec Riese of Python},\n", " author = {Wilmington, Oliver},\n", " journal = {The Jupyter Times},\n", " month = {November 24th, 2012},\n", " pages = {4 - 7},\n", " year = {2012}\n", "}\n", "\n", "@book{calicoww2:1,\n", " title = {Calico and WWII: Untold History},\n", " author = {French, Viola},\n", " year = {1997},\n", " publisher = {Calicia City Free Press}\n", "}\n", "\n", "@book{calicoww2:2,\n", " title = {Rebuilding Calico After Japanese Occupation},\n", " author = {Kepps, Milo },\n", " year = {2002},\n", " publisher = {Python Books}\n", "}\n", "-->\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5.2 Cite Commands and Citation IDs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When you want to cite a bibliographic entry from a database (either internal or external), you must know the citation ID, sometimes called the \"key\", for that entry. Citation IDs are strings of letters, numbers, and symbols that *you* make up, so they can be any word or combination of words you find easy to remember. Once, you've given an entry a citation ID, however, you do need to use that same ID every time you cite that source, so it may behoove you to keep your database organized. This way it will be much easier to locate any given source's entry and its potentially forgotten citation ID. \n", "\n", "Once you know the citation ID for a given entry, use the following format to indicate to your Notebook's bibliographic support that you'd like to insert an in-text citation:\n", "\n", "\n", "[](#cite-CITATION ID)\n", "\n", "\n", "This format is the cite command. For example, if you wanted to cite *Rebuilding Calico After Japanese Occupation* listed above, you would use the cite command and the specific citation ID for that source:\n", "\n", "\n", "[](#cite-calicoww2:2)\n", "\n", "\n", "Before clicking the \"Generate References\" button, your unrendered text might look like this:\n", "\n", "\n", "\n", "Rebuilding Calico took many years [](#cite-calicoww2:2).\n", "\n", "\n", "\n", "After clicking the \"Generate References\" button, your unrendered text might look like this:\n", "\n", "\n", "\n", "Rebuilding Calico took many years <a name=\"ref-1\"/>[(Kepps, 2002)](#cite-calicoww2:2).\n", "\n", "\n", "\n", "and then the text would render as:\n", "\n", "\n", ">Rebuilding Calico took many years [(Kepps, 2002)](#cite-calicoww2:2).\n", "\n", "\n", "In addition, a cell would be added at the bottom with the following contents:\n", "\n", "\n", ">#References\n", "\n", ">[^](#ref-1) [^](#ref-2) Kepps, Milo . 2002. _Rebuilding Calico After Japanese Occupation_.\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 6. Turning Your Jupyter Notebook into a Slideshow" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To install slideshow support for your Notebook, go [here](http://nbviewer.ipython.org/github/fperez/nb-slideshow-template/blob/master/install-support.ipynb).\n", "\n", "To see a tutorial and example slideshow, go [here](http://www.damian.oquanta.info/posts/make-your-slides-with-ipython.html)." ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }