commit
7b3c01c667
@ -0,0 +1,179 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011 The IPython Development Team
|
||||
//
|
||||
// Distributed under the terms of the BSD License. The full license is in
|
||||
// the file COPYING, distributed as part of this software.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
// ToolBar
|
||||
//============================================================================
|
||||
|
||||
var IPython = (function (IPython) {
|
||||
|
||||
var MainToolBar = function (selector) {
|
||||
this.selector = selector;
|
||||
IPython.ToolBar.apply(this, arguments);
|
||||
this.construct();
|
||||
this.add_drop_down_list();
|
||||
this.bind_events();
|
||||
};
|
||||
|
||||
MainToolBar.prototype = new IPython.ToolBar();
|
||||
|
||||
MainToolBar.prototype.construct = function () {
|
||||
this.add_buttons_group([
|
||||
{
|
||||
id : 'save_b',
|
||||
label : 'Save',
|
||||
icon : 'ui-icon-disk',
|
||||
callback : function () {
|
||||
IPython.notebook.save_notebook();
|
||||
}
|
||||
}
|
||||
]);
|
||||
this.add_buttons_group([
|
||||
{
|
||||
id : 'cut_b',
|
||||
label : 'Cut Cell',
|
||||
icon : 'ui-icon-scissors',
|
||||
callback : function () {
|
||||
IPython.notebook.cut_cell();
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'copy_b',
|
||||
label : 'Copy Cell',
|
||||
icon : 'ui-icon-copy',
|
||||
callback : function () {
|
||||
IPython.notebook.copy_cell();
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'paste_b',
|
||||
label : 'Paste Cell Below',
|
||||
icon : 'ui-icon-clipboard',
|
||||
callback : function () {
|
||||
IPython.notebook.paste_cell_below();
|
||||
}
|
||||
}
|
||||
],'cut_copy_paste');
|
||||
|
||||
this.add_buttons_group([
|
||||
{
|
||||
id : 'move_up_b',
|
||||
label : 'Move Cell Up',
|
||||
icon : 'ui-icon-arrowthick-1-n',
|
||||
callback : function () {
|
||||
IPython.notebook.move_cell_up();
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'move_down_b',
|
||||
label : 'Move Cell Down',
|
||||
icon : 'ui-icon-arrowthick-1-s',
|
||||
callback : function () {
|
||||
IPython.notebook.move_cell_down();
|
||||
}
|
||||
}
|
||||
],'move_up_down');
|
||||
|
||||
this.add_buttons_group([
|
||||
{
|
||||
id : 'insert_above_b',
|
||||
label : 'Insert Cell Above',
|
||||
icon : 'ui-icon-arrowthickstop-1-n',
|
||||
callback : function () {
|
||||
IPython.notebook.insert_cell_above('code');
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'insert_below_b',
|
||||
label : 'Insert Cell Below',
|
||||
icon : 'ui-icon-arrowthickstop-1-s',
|
||||
callback : function () {
|
||||
IPython.notebook.insert_cell_below('code');
|
||||
}
|
||||
}
|
||||
],'insert_above_below');
|
||||
|
||||
this.add_buttons_group([
|
||||
{
|
||||
id : 'run_b',
|
||||
label : 'Run Cell',
|
||||
icon : 'ui-icon-play',
|
||||
callback : function () {
|
||||
IPython.notebook.execute_selected_cell();
|
||||
}
|
||||
},
|
||||
{
|
||||
id : 'interrupt_b',
|
||||
label : 'Interrupt',
|
||||
icon : 'ui-icon-stop',
|
||||
callback : function () {
|
||||
IPython.notebook.kernel.interrupt();
|
||||
}
|
||||
}
|
||||
],'run_int');
|
||||
|
||||
|
||||
};
|
||||
|
||||
MainToolBar.prototype.add_drop_down_list = function () {
|
||||
var select = $(this.selector)
|
||||
.append($('<select/>')
|
||||
.attr('id','cell_type')
|
||||
.addClass('ui-widget ui-widget-content')
|
||||
.append($('<option/>').attr('value','code').text('Code'))
|
||||
.append($('<option/>').attr('value','markdown').text('Markdown'))
|
||||
.append($('<option/>').attr('value','raw').text('Raw Text'))
|
||||
.append($('<option/>').attr('value','heading1').text('Heading 1'))
|
||||
.append($('<option/>').attr('value','heading2').text('Heading 2'))
|
||||
.append($('<option/>').attr('value','heading3').text('Heading 3'))
|
||||
.append($('<option/>').attr('value','heading4').text('Heading 4'))
|
||||
.append($('<option/>').attr('value','heading5').text('Heading 5'))
|
||||
.append($('<option/>').attr('value','heading6').text('Heading 6'))
|
||||
.append($('<option/>').attr('value','heading7').text('Heading 7'))
|
||||
.append($('<option/>').attr('value','heading8').text('Heading 8'))
|
||||
);
|
||||
};
|
||||
|
||||
MainToolBar.prototype.bind_events = function () {
|
||||
var that = this;
|
||||
|
||||
this.element.find('#cell_type').change(function () {
|
||||
var cell_type = $(this).val();
|
||||
if (cell_type === 'code') {
|
||||
IPython.notebook.to_code();
|
||||
} else if (cell_type === 'markdown') {
|
||||
IPython.notebook.to_markdown();
|
||||
} else if (cell_type === 'raw') {
|
||||
IPython.notebook.to_raw();
|
||||
} else if (cell_type === 'heading1') {
|
||||
IPython.notebook.to_heading(undefined, 1);
|
||||
} else if (cell_type === 'heading2') {
|
||||
IPython.notebook.to_heading(undefined, 2);
|
||||
} else if (cell_type === 'heading3') {
|
||||
IPython.notebook.to_heading(undefined, 3);
|
||||
} else if (cell_type === 'heading4') {
|
||||
IPython.notebook.to_heading(undefined, 4);
|
||||
} else if (cell_type === 'heading5') {
|
||||
IPython.notebook.to_heading(undefined, 5);
|
||||
} else if (cell_type === 'heading6') {
|
||||
IPython.notebook.to_heading(undefined, 6);
|
||||
}
|
||||
});
|
||||
$([IPython.events]).on('selected_cell_type_changed.Notebook', function (event, data) {
|
||||
if (data.cell_type === 'heading') {
|
||||
that.element.find('#cell_type').val(data.cell_type+data.level);
|
||||
} else {
|
||||
that.element.find('#cell_type').val(data.cell_type);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
IPython.MainToolBar = MainToolBar;
|
||||
|
||||
return IPython;
|
||||
|
||||
}(IPython));
|
||||
@ -0,0 +1,241 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2012 The IPython Development Team
|
||||
//
|
||||
// Distributed under the terms of the BSD License. The full license is in
|
||||
// the file COPYING, distributed as part of this software.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//============================================================================
|
||||
// MathJax utility functions
|
||||
//============================================================================
|
||||
|
||||
IPython.namespace('IPython.mathjaxutils');
|
||||
|
||||
IPython.mathjaxutils = (function (IPython) {
|
||||
|
||||
var init = function () {
|
||||
if (window.MathJax) {
|
||||
// MathJax loaded
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||
processEnvironments: true
|
||||
},
|
||||
displayAlign: 'left', // Change this to 'center' to center equations.
|
||||
"HTML-CSS": {
|
||||
styles: {'.MathJax_Display': {"margin": 0}}
|
||||
}
|
||||
});
|
||||
MathJax.Hub.Configured();
|
||||
} else if (window.mathjax_url != "") {
|
||||
// Don't have MathJax, but should. Show dialog.
|
||||
var dialog = $('<div></div>')
|
||||
.append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"Math/LaTeX rendering will be disabled."
|
||||
)
|
||||
).append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"If you have administrative access to the notebook server and" +
|
||||
" a working internet connection, you can install a local copy" +
|
||||
" of MathJax for offline use with the following command on the server" +
|
||||
" at a Python or IPython prompt:"
|
||||
)
|
||||
).append(
|
||||
$("<pre></pre>").addClass('dialog').html(
|
||||
">>> from IPython.external import mathjax; mathjax.install_mathjax()"
|
||||
)
|
||||
).append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"This will try to install MathJax into the IPython source directory."
|
||||
)
|
||||
).append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"If IPython is installed to a location that requires" +
|
||||
" administrative privileges to write, you will need to make this call as" +
|
||||
" an administrator, via 'sudo'."
|
||||
)
|
||||
).append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"When you start the notebook server, you can instruct it to disable MathJax support altogether:"
|
||||
)
|
||||
).append(
|
||||
$("<pre></pre>").addClass('dialog').html(
|
||||
"$ ipython notebook --no-mathjax"
|
||||
)
|
||||
).append(
|
||||
$("<p></p>").addClass('dialog').html(
|
||||
"which will prevent this dialog from appearing."
|
||||
)
|
||||
).dialog({
|
||||
title: "Failed to retrieve MathJax from '" + window.mathjax_url + "'",
|
||||
width: "70%",
|
||||
modal: true,
|
||||
})
|
||||
} else {
|
||||
// No MathJax, but none expected. No dialog.
|
||||
};
|
||||
};
|
||||
|
||||
// Some magic for deferring mathematical expressions to MathJax
|
||||
// by hiding them from the Markdown parser.
|
||||
// Some of the code here is adapted with permission from Davide Cervone
|
||||
// under the terms of the Apache2 license governing the MathJax project.
|
||||
// Other minor modifications are also due to StackExchange and are used with
|
||||
// permission.
|
||||
|
||||
var inline = "$"; // the inline math delimiter
|
||||
var blocks, start, end, last, braces; // used in searching for math
|
||||
var math; // stores math until pagedown (Markdown parser) is done
|
||||
|
||||
// MATHSPLIT contains the pattern for math delimiters and special symbols
|
||||
// needed for searching for math in the text input.
|
||||
var MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i;
|
||||
|
||||
// The math is in blocks i through j, so
|
||||
// collect it into one block and clear the others.
|
||||
// Replace &, <, and > by named entities.
|
||||
// For IE, put <br> at the ends of comments since IE removes \n.
|
||||
// Clear the current math positions and store the index of the
|
||||
// math, then push the math string onto the storage array.
|
||||
// The preProcess function is called on all blocks if it has been passed in
|
||||
var process_math = function (i, j, pre_process) {
|
||||
var hub = MathJax.Hub;
|
||||
var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&") // use HTML entity for &
|
||||
.replace(/</g, "<") // use HTML entity for <
|
||||
.replace(/>/g, ">") // use HTML entity for >
|
||||
;
|
||||
if (hub.Browser.isMSIE) {
|
||||
block = block.replace(/(%[^\n]*)\n/g, "$1<br/>\n")
|
||||
}
|
||||
while (j > i) {
|
||||
blocks[j] = "";
|
||||
j--;
|
||||
}
|
||||
blocks[i] = "@@" + math.length + "@@"; // replace the current block text with a unique tag to find later
|
||||
if (pre_process)
|
||||
block = pre_process(block);
|
||||
math.push(block);
|
||||
start = end = last = null;
|
||||
}
|
||||
|
||||
// Break up the text into its component parts and search
|
||||
// through them for math delimiters, braces, linebreaks, etc.
|
||||
// Math delimiters must match and braces must balance.
|
||||
// Don't allow math to pass through a double linebreak
|
||||
// (which will be a paragraph).
|
||||
//
|
||||
var remove_math = function (text) {
|
||||
if (!window.MathJax) {
|
||||
return text;
|
||||
}
|
||||
|
||||
start = end = last = null; // for tracking math delimiters
|
||||
math = []; // stores math strings for later
|
||||
|
||||
// Except for extreme edge cases, this should catch precisely those pieces of the markdown
|
||||
// source that will later be turned into code spans. While MathJax will not TeXify code spans,
|
||||
// we still have to consider them at this point; the following issue has happened several times:
|
||||
//
|
||||
// `$foo` and `$bar` are varibales. --> <code>$foo ` and `$bar</code> are variables.
|
||||
|
||||
var hasCodeSpans = /`/.test(text),
|
||||
de_tilde;
|
||||
if (hasCodeSpans) {
|
||||
text = text.replace(/~/g, "~T").replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, function (wholematch) {
|
||||
return wholematch.replace(/\$/g, "~D");
|
||||
});
|
||||
de_tilde = function (text) { return text.replace(/~([TD])/g, function (wholematch, character) { return { T: "~", D: "$" }[character]; }) };
|
||||
} else {
|
||||
de_tilde = function (text) { return text; };
|
||||
}
|
||||
|
||||
blocks = IPython.utils.regex_split(text.replace(/\r\n?/g, "\n"),MATHSPLIT);
|
||||
|
||||
for (var i = 1, m = blocks.length; i < m; i += 2) {
|
||||
var block = blocks[i];
|
||||
if (block.charAt(0) === "@") {
|
||||
//
|
||||
// Things that look like our math markers will get
|
||||
// stored and then retrieved along with the math.
|
||||
//
|
||||
blocks[i] = "@@" + math.length + "@@";
|
||||
math.push(block);
|
||||
}
|
||||
else if (start) {
|
||||
//
|
||||
// If we are in math, look for the end delimiter,
|
||||
// but don't go past double line breaks, and
|
||||
// and balance braces within the math.
|
||||
//
|
||||
if (block === end) {
|
||||
if (braces) {
|
||||
last = i
|
||||
}
|
||||
else {
|
||||
process_math(start, i, de_tilde)
|
||||
}
|
||||
}
|
||||
else if (block.match(/\n.*\n/)) {
|
||||
if (last) {
|
||||
i = last;
|
||||
process_math(start, i, de_tilde)
|
||||
}
|
||||
start = end = last = null;
|
||||
braces = 0;
|
||||
}
|
||||
else if (block === "{") {
|
||||
braces++
|
||||
}
|
||||
else if (block === "}" && braces) {
|
||||
braces--
|
||||
}
|
||||
}
|
||||
else {
|
||||
//
|
||||
// Look for math start delimiters and when
|
||||
// found, set up the end delimiter.
|
||||
//
|
||||
if (block === inline || block === "$$") {
|
||||
start = i;
|
||||
end = block;
|
||||
braces = 0;
|
||||
}
|
||||
else if (block.substr(1, 5) === "begin") {
|
||||
start = i;
|
||||
end = "\\end" + block.substr(6);
|
||||
braces = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last) {
|
||||
process_math(start, last, de_tilde)
|
||||
}
|
||||
return de_tilde(blocks.join(""));
|
||||
}
|
||||
|
||||
//
|
||||
// Put back the math strings that were saved,
|
||||
// and clear the math array (no need to keep it around).
|
||||
//
|
||||
var replace_math = function (text) {
|
||||
if (!window.MathJax) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = text.replace(/@@(\d+)@@/g, function (match, n) {
|
||||
return math[n]
|
||||
});
|
||||
math = null;
|
||||
return text;
|
||||
}
|
||||
|
||||
return {
|
||||
init : init,
|
||||
process_math : process_math,
|
||||
remove_math : remove_math,
|
||||
replace_math : replace_math
|
||||
};
|
||||
|
||||
}(IPython));
|
||||
@ -0,0 +1,259 @@
|
||||
{
|
||||
"metadata": {
|
||||
"name": "Typesetting Math Using MathJax"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
"worksheets": [
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"The Markdown parser included in IPython is MathJax-aware. This means that you can freely mix in mathematical expressions using the [MathJax subset of Tex and LaTeX](http://docs.mathjax.org/en/latest/tex.html#tex-support). [Some examples from the MathJax site](http://www.mathjax.org/demos/tex-samples/) are reproduced below, as well as the Markdown+TeX source."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Motivating Examples\n",
|
||||
"\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"## The Lorenz Equations\n",
|
||||
"### Source\n",
|
||||
"```\\begin{aligned}\n",
|
||||
"\\dot{x} & = \\sigma(y-x) \\\\\n",
|
||||
"\\dot{y} & = \\rho x - y - xz \\\\\n",
|
||||
"\\dot{z} & = -\\beta z + xy\n",
|
||||
"\\end{aligned}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\dot{x} & = \\sigma(y-x) \\\\\n",
|
||||
"\\dot{y} & = \\rho x - y - xz \\\\\n",
|
||||
"\\dot{z} & = -\\beta z + xy\n",
|
||||
"\\end{aligned}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## The Cauchy-Schwarz Inequality\n",
|
||||
"### Source\n",
|
||||
"```\\begin{equation*}\n",
|
||||
"\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)\n",
|
||||
"\\end{equation*}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{equation*}\n",
|
||||
"\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)\n",
|
||||
"\\end{equation*}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## A Cross Product Formula\n",
|
||||
"### Source\n",
|
||||
"```\\begin{equation*}\n",
|
||||
"\\mathbf{V}_1 \\times \\mathbf{V}_2 = \\begin{vmatrix}\n",
|
||||
"\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
|
||||
"\\frac{\\partial X}{\\partial u} & \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
|
||||
"\\frac{\\partial X}{\\partial v} & \\frac{\\partial Y}{\\partial v} & 0\n",
|
||||
"\\end{vmatrix} \n",
|
||||
"\\end{equation*}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{equation*}\n",
|
||||
"\\mathbf{V}_1 \\times \\mathbf{V}_2 = \\begin{vmatrix}\n",
|
||||
"\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
|
||||
"\\frac{\\partial X}{\\partial u} & \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
|
||||
"\\frac{\\partial X}{\\partial v} & \\frac{\\partial Y}{\\partial v} & 0\n",
|
||||
"\\end{vmatrix} \n",
|
||||
"\\end{equation*}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## The probability of getting \\(k\\) heads when flipping \\(n\\) coins is\n",
|
||||
"### Source\n",
|
||||
"```\\begin{equation*}\n",
|
||||
"P(E) = {n \\choose k} p^k (1-p)^{ n-k} \n",
|
||||
"\\end{equation*}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{equation*}\n",
|
||||
"P(E) = {n \\choose k} p^k (1-p)^{ n-k} \n",
|
||||
"\\end{equation*}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## An Identity of Ramanujan\n",
|
||||
"### Source\n",
|
||||
"```\\begin{equation*}\n",
|
||||
"\\frac{1}{\\Bigl(\\sqrt{\\phi \\sqrt{5}}-\\phi\\Bigr) e^{\\frac25 \\pi}} =\n",
|
||||
"1+\\frac{e^{-2\\pi}} {1+\\frac{e^{-4\\pi}} {1+\\frac{e^{-6\\pi}}\n",
|
||||
"{1+\\frac{e^{-8\\pi}} {1+\\ldots} } } } \n",
|
||||
"\\end{equation*}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{equation*}\n",
|
||||
"\\frac{1}{\\Bigl(\\sqrt{\\phi \\sqrt{5}}-\\phi\\Bigr) e^{\\frac25 \\pi}} =\n",
|
||||
"1+\\frac{e^{-2\\pi}} {1+\\frac{e^{-4\\pi}} {1+\\frac{e^{-6\\pi}}\n",
|
||||
"{1+\\frac{e^{-8\\pi}} {1+\\ldots} } } } \n",
|
||||
"\\end{equation*}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## A Rogers-Ramanujan Identity\n",
|
||||
"### Source\n",
|
||||
"```\\begin{equation*}\n",
|
||||
"1 + \\frac{q^2}{(1-q)}+\\frac{q^6}{(1-q)(1-q^2)}+\\cdots =\n",
|
||||
"\\prod_{j=0}^{\\infty}\\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},\n",
|
||||
"\\quad\\quad \\text{for $|q|<1$}. \n",
|
||||
"\\end{equation*}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{equation*}\n",
|
||||
"1 + \\frac{q^2}{(1-q)}+\\frac{q^6}{(1-q)(1-q^2)}+\\cdots =\n",
|
||||
"\\prod_{j=0}^{\\infty}\\frac{1}{(1-q^{5j+2})(1-q^{5j+3})},\n",
|
||||
"\\quad\\quad \\text{for $|q|<1$}. \n",
|
||||
"\\end{equation*}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Maxwell's Equations\n",
|
||||
"### Source\n",
|
||||
"```\\begin{aligned}\n",
|
||||
"\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\n",
|
||||
"\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
|
||||
"\\nabla \\cdot \\vec{\\mathbf{B}} & = 0 \n",
|
||||
"\\end{aligned}\n",
|
||||
"```\n",
|
||||
"### Display\n",
|
||||
"\\begin{aligned}\n",
|
||||
"\\nabla \\times \\vec{\\mathbf{B}} -\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{E}}}{\\partial t} & = \\frac{4\\pi}{c}\\vec{\\mathbf{j}} \\\\ \\nabla \\cdot \\vec{\\mathbf{E}} & = 4 \\pi \\rho \\\\\n",
|
||||
"\\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
|
||||
"\\nabla \\cdot \\vec{\\mathbf{B}} & = 0 \n",
|
||||
"\\end{aligned}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Equation Numbering and References\n",
|
||||
"\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"Equation numbering and referencing will be available in a future version of IPython."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Inline Typesetting (Mixing Markdown and TeX)\n",
|
||||
"\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"While display equations look good for a page of samples, the ability to mix math and *formatted* **text** in a paragraph is also important.\n",
|
||||
"\n",
|
||||
"## Source\n",
|
||||
"``` This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a **[Markdown-formatted](http://daringfireball.net/projects/markdown/)** sentence. \n",
|
||||
"```\n",
|
||||
"## Display\n",
|
||||
"This expression $\\sqrt{3x-1}+(1+x)^2$ is an example of a TeX inline equation in a **[Markdown-formatted](http://daringfireball.net/projects/markdown/)** sentence. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Other Syntax\n",
|
||||
"\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"You will notice in other places on the web that `$$` are needed explicitly to begin and end MathJax typesetting. This is **not** required if you will be using TeX environments, but the IPython notebook will accept this syntax on legacy notebooks. \n",
|
||||
"\n",
|
||||
"### Source\n",
|
||||
"```$$\n",
|
||||
"\\begin{array}{c}\n",
|
||||
"y_1 \\\\\\\n",
|
||||
"y_2 \\mathtt{t}_i \\\\\\\n",
|
||||
"z_{3,4}\n",
|
||||
"\\end{array}\n",
|
||||
"$$\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"$$\n",
|
||||
"\\begin{array}{c}\n",
|
||||
"y_1 \\cr\n",
|
||||
"y_2 \\mathtt{t}_i \\cr\n",
|
||||
"y_{3}\n",
|
||||
"\\end{array}\n",
|
||||
"$$\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"$$\\begin{eqnarray} \n",
|
||||
"x' &=& &x \\sin\\phi &+& z \\cos\\phi \\\\\n",
|
||||
"z' &=& - &x \\cos\\phi &+& z \\sin\\phi \\\\\n",
|
||||
"\\end{eqnarray}$$\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"```\n",
|
||||
"$$\n",
|
||||
"x=4\n",
|
||||
"$$\n",
|
||||
"```\n",
|
||||
"\n",
|
||||
"### Display\n",
|
||||
"$$\n",
|
||||
"\\begin{array}{c}\n",
|
||||
"y_1 \\\\\\\n",
|
||||
"y_2 \\mathtt{t}_i \\\\\\\n",
|
||||
"z_{3,4}\n",
|
||||
"\\end{array}\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"\\begin{array}{c}\n",
|
||||
"y_1 \\cr\n",
|
||||
"y_2 \\mathtt{t}_i \\cr\n",
|
||||
"y_{3}\n",
|
||||
"\\end{array}\n",
|
||||
"$$\n",
|
||||
"\n",
|
||||
"$$\\begin{eqnarray} \n",
|
||||
"x' &=& &x \\sin\\phi &+& z \\cos\\phi \\\\\n",
|
||||
"z' &=& - &x \\cos\\phi &+& z \\sin\\phi \\\\\n",
|
||||
"\\end{eqnarray}$$\n",
|
||||
"\n",
|
||||
"$$\n",
|
||||
"x=4\n",
|
||||
"$$"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in new issue