{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "All the IPython Notebooks in **Python Introduction** lecture series by **[Dr. Milaan Parmar](https://www.linkedin.com/in/milaanparmar/)** are available @ **[GitHub](https://github.com/milaan9/01_Python_Introduction)**\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Keyboard Shortcuts Practice\n", "\n", "Taking a few minutes to learn certain Jupyter Notebook keyboard shortcuts has helped me be a more efficient Python developer. Below are the keyboard shortcuts I've found most useful.\n", "\n", ">**Note:** these keyboard shortcuts are for Jupyter version 4.1.0 and Mac OSX. For most shortcuts below, you can replace **`cmd`** for **`Ctrl`** and **`option`** for **`Alt`** for Windows or Linux. Or, you can use the **`H`** keyboard shortcut in Windows or Linux to confirm the appropriate keyboard shortcuts for those operating systems." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Command vs. Edit Modes\n", "\n", "But first...something key to be aware of: Jupyter Notebooks have two different keyboard input modes:\n", "\n", "1. **Command mode** - binds the keyboard to notebook level actions. Indicated by a grey cell border with a **blue** left margin.\n", "2. **Edit mode** - when you're typing in a cell. Indicated by a green cell border with a **green** left margin.\n", "\n", "Experiment with switching between command and edit modes in this cell. Hint: If you're in command mode, press Enter to enter edit mode. If you're in edit mode, press Esc to enter command mode." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Command Mode\n", "\n", "Let's practice the command mode first.\n", "\n", "To start, select the next cell and press Shift + Enter to run that cell and select the next cell" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:02:49.349781Z", "start_time": "2021-06-22T07:02:49.332207Z" } }, "outputs": [], "source": [ "print(\"You just ran the cell and selected the next cell\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With the next cell selected, press Ctrl + Enter to run the cell and keep the same cell selected" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:02:52.588086Z", "start_time": "2021-06-22T07:02:52.581250Z" } }, "outputs": [], "source": [ "print(\"You just ran the cell and the focus stayed in that cell\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "With the next cell selected, press Alt + Enter to run the cell and insert a new cell below" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:03:06.788366Z", "start_time": "2021-06-22T07:03:06.772743Z" } }, "outputs": [], "source": [ "print(\"You just ran the cell and inserted a new cell below it\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Ctrl + S save and checkpoint." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Press A to insert a new cell above this one\n", "\n", "Then, press B to insert a new cell below." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Copy the next cell with C and then paste it with V" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"copy me\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Delete the cell below by selecting it and press D D (i.e., hit the D button twice)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"delete me\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Merge the following two cells by selecting the first one and then press Shift + M\n", "\n", "First select the cells to merge by pressing Shift + or " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-09-10T12:33:13.348589Z", "start_time": "2021-09-10T12:33:13.338826Z" } }, "outputs": [], "source": [ "print(\"click me and then merge me with the next cell\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"merge me with the cell above\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Undo the previous option using span Esc + Z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Experiment with changing the following cells to **`code`** and **`markdown`** modes\n", "\n", "Y change the cell type to *Code*\n", "\n", "M change the cell type to *Markdown*" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:07:11.233323Z", "start_time": "2021-06-22T07:07:11.227467Z" } }, "outputs": [], "source": [ "```\n", "print(\"I should be in Markdown mode. Type `M` to change me to markdown. Then type `shift` + `enter` to see the proper markup\")\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "print(\"I should be code. Select me and then type **`Y`** to change me to **`code`** mode\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Edit Mode\n", "\n", "Use the Ctrl + **`hold left click`** to quickly change all occurences of **`variable_x`** to **`var_x`**." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T06:57:02.791439Z", "start_time": "2021-06-22T06:57:02.776795Z" } }, "outputs": [], "source": [ "variable_a = 1\n", "variable_b = variable_a*2\n", "variable_c = variable_a + variable_b" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use Alt + **`hold left click`** for column editing to easily indent each of the following **`linex_fix_indent`**" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:12:01.286892Z", "start_time": "2021-06-22T07:12:01.269316Z" } }, "outputs": [], "source": [ "def my_func():\n", "line1_fix_indent\n", "line2_fix_indent\n", "line3_fix_indent\n", "line4_fix_indent\n", "line5_fix_indent\n", "line6_fix_indent\n", "line7_fix_indent\n", "line8_fix_indent" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "___\n", "Select the entire text in the next cell and press Ctrl + / to toggle comment lines" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(\"this\")\n", "print(\"is\")\n", "print(\"a big\")\n", "print(\"block of\")\n", "print(\"text to comment\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "\n", "Run the next cell to import numpy and then put your cursor next to the **`np.`** in the following cell. Then, press Tab to see what code completions are available" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:16:25.503428Z", "start_time": "2021-06-22T07:16:25.488785Z" } }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-22T07:16:27.219251Z", "start_time": "2021-06-22T07:16:27.212416Z" } }, "outputs": [], "source": [ "np." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Put your cursor between the **`()`** in the **`np.arange()`** code below. Then press Shift + Tab to get the tooltip" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "np.arange()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use Ctrl + Shift + - split the following cell between the two functions" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def func1():\n", " print(\"I'm func1. Separate me from func2\")\n", " \n", "def func2():\n", " print(\"I'm \")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Command Palette\n", "\n", "Ctrl + Shift + P\n", "\n", "Want quick access to all the commands in Jupyter Notebooks? Open the command palette with Ctrl + Shift + P and you'll quickly be able to search all the commands!\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### View all keyboard shortcuts\n", "\n", "H (in Command mode)\n", "\n", "These are the shortcuts I use in my daily work. If you still need something that is not mentioned here you can find it in the keyboard shortcuts dialog H. You can also **edit** existing or **add** more **shortcuts** from the **`Help`** ↪ **`Edit`** **Keyboard Shortcuts** link in the menu bar. Clicking the link will open a dialog. At the bottom of it there are rules for adding or editing shortcuts. You need to use hyphens - to represent keys that should be pressed at the same time.\n", "\n", "For example, I added a shortcut **`Ctrl-R`** for the restart kernel and run all cells command." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Insert Image" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-09-10T12:46:00.638175Z", "start_time": "2021-09-10T12:46:00.493648Z" } }, "outputs": [], "source": [ "from IPython.display import Image\n", "Image(\"img\\logo.png\") " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Markdown\n", "\n", "For each sub-section: The first cell is code representation and next cell is the output representation in **`Markdown`**." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Headers" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-23T17:40:38.007135Z", "start_time": "2021-06-23T17:40:37.994443Z" } }, "outputs": [], "source": [ "# Heading 1 \n", "## Heading 2 \n", "### Heading 3\n", "#### Heading 4\n", "##### Heading 5\n", "###### Heading 6\n", "\n", "Alternatively, for H1 and H2, an underline-ish style:\n", "\n", "Alt-H1\n", "======\n", "\n", "Alt-H2\n", "------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Heading 1 \n", "## Heading 2 \n", "### Heading 3\n", "#### Heading 4\n", "##### Heading 5\n", "###### Heading 6\n", "\n", "Alternatively, for H1 and H2, an underline-ish style:\n", "\n", "Alt-H1\n", "======\n", "\n", "Alt-H2\n", "------" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Emphasis" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Emphasis, aka italics, with *asterisks* or _underscores_.\n", "\n", "Strong emphasis, aka bold, with **asterisks** or __underscores__.\n", "\n", "Combined emphasis with **asterisks and _underscores_**.\n", "\n", "Strikethrough uses two tildes. ~~Scratch this.~~" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-06-23T17:46:26.180871Z", "start_time": "2021-06-23T17:46:26.160853Z" } }, "source": [ "Emphasis, aka italics, with *asterisks* or _underscores_.\n", "\n", "Strong emphasis, aka bold, with **asterisks** or __underscores__.\n", "\n", "Combined emphasis with **asterisks and _underscores_**.\n", "\n", "Strikethrough uses two tildes. ~~Scratch this.~~" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Colors" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Use this code: Text Not all markdown code works within a font tag, so review your colored text carefully!\n", "\n", "Front color is blue\n", "\n", "Front color is red\n", "\n", "Front color is yellow" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Use this code: Text Not all markdown code works within a font tag, so review your colored text carefully!\n", "\n", "Front color is blue\n", "\n", "Front color is red\n", "\n", "Front color is yellow" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### Lists" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-10-17T12:13:04.455269Z", "start_time": "2021-10-17T12:13:04.429390Z" } }, "outputs": [], "source": [ "1. First ordered list item\n", "2. Another item\n", " * Unordered sub-list. \n", "1. Actual numbers don't matter, just that it's a number\n", " 1. Ordered sub-list\n", "4. And another item. \n", " \n", " Some text that should be aligned with the above item.\n", "\n", "* Unordered list can use asterisks\n", "- Or minuses\n", "+ Or pluses\n", "\n", "\n", "1. Today's\n", "2. date is:\n", " * Monday\n", " * 16th January 1991\n", " - hello! how are\n", " - how are you?\n", " - Hope doing well \n", " \n", "\n", " - [ ] Item A\n", " - [x] Item B\n", " - [x] Item C" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. First ordered list item\n", "2. Another item\n", " * Unordered sub-list. \n", "1. Actual numbers don't matter, just that it's a number\n", " 1. Ordered sub-list\n", "4. And another item. \n", " \n", " Some text that should be aligned with the above item.\n", "\n", "* Unordered list can use asterisks\n", "- Or minuses\n", "+ Or pluses\n", "\n", "\n", "1. Today's\n", "2. date is:\n", " * Monday\n", " * 16th January 1991\n", " - hello! how are\n", " - how are you?\n", " - Hope doing well \n", " \n", " - [ ] Item A\n", " - [x] Item B\n", " - [x] Item C" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "### Links\n", "\n", "#### Websites and References\n", "\n", "There are two ways to create links:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-10-17T12:13:40.419633Z", "start_time": "2021-10-17T12:13:40.408890Z" } }, "outputs": [], "source": [ "[I'm an inline-style link](https://www.github.com)\n", " \n", "[Metric](https://en.wikipedia.org/wiki/Metric_(mathematics))\n", " \n", "[Metric](https://en.wikipedia.org/wiki/Metric_%28mathematics%29)\n", "\n", "[I'm a reference-style link][Arbitrary case-insensitive reference text]\n", "\n", "[You can use numbers for reference-style link definitions][1]\n", "\n", "Or leave it empty and use the [link text itself]\n", "\n", "URLs and URLs in angle brackets will automatically get turned into links. \n", "http://www.example.com or and sometimes \n", "example.com (but not on Github, for example).\n", "\n", "Some text to show that the reference links can follow later.\n", "\n", "[arbitrary case-insensitive reference text]: https://www.mozilla.org\n", "[1]: http://slashdot.org\n", "[link text itself]: http://www.reddit.com" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-06-23T17:52:47.382778Z", "start_time": "2021-06-23T17:52:47.360321Z" } }, "source": [ "[I'm an inline-style link](https://www.github.com)\n", " \n", "[Metric](https://en.wikipedia.org/wiki/Metric_(mathematics))\n", " \n", "[Metric](https://en.wikipedia.org/wiki/Metric_%28mathematics%29)\n", "\n", "[I'm a reference-style link][Arbitrary case-insensitive reference text]\n", "\n", "[You can use numbers for reference-style link definitions][1]\n", "\n", "Or leave it empty and use the [link text itself]\n", "\n", "URLs and URLs in angle brackets will automatically get turned into links. \n", "http://www.example.com or and sometimes \n", "example.com (but not on Github, for example).\n", "\n", "Some text to show that the reference links can follow later.\n", "\n", "[arbitrary case-insensitive reference text]: https://www.mozilla.org\n", "[1]: http://slashdot.org\n", "[link text itself]: http://www.reddit.com" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Internal links in Jupyter\n", "\n", "There are two ways to create links:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "\n", "[Links](#links)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "[Links](#links)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Blockquotes" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "> Blockquotes are very handy in email to emulate reply text.\n", "> This line is part of the same quote.\n", " > This line is also part of the same quote.\n", ">> This line too. \n", "\n", "Quote break.\n", "\n", "> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> Blockquotes are very handy in email to emulate reply text.\n", "> This line is part of the same quote.\n", " > This line is also part of the same quote.\n", ">> This line too. \n", "\n", "Quote break.\n", "\n", "> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Inline HTML\n", "\n", "You can also use raw HTML in your Markdown, and it'll mostly work pretty well." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "
\n", "
Definition list
\n", "
Is something people use sometimes.
\n", "\n", "
Markdown in HTML
\n", "
Does *not* work **very** well. Use HTML tags.
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "
Definition list
\n", "
Is something people use sometimes.
\n", "\n", "
Markdown in HTML
\n", "
Does *not* work **very** well. Use HTML tags.
\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Horizontal Rule" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Three or more...\n", "\n", "---\n", "\n", "Hyphens\n", "\n", "***\n", "\n", "Asterisks\n", "\n", "___\n", "\n", "Underscores" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Three or more...\n", "\n", "---\n", "\n", "Hyphens\n", "\n", "***\n", "\n", "Asterisks\n", "\n", "___\n", "\n", "Underscores" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Line Breaks\n", "\n", "My basic recommendation for learning how line breaks work is to experiment and discover -- hit once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. \"Markdown Toggle\" is your friend.\n", "\n", "Here are some things to try out:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Here's a line for us to start with.\n", "\n", "This line is separated from the one above by two newlines, so it will be a *separate paragraph*.\n", "\n", "This line is also a separate paragraph, but...\n", "This line is only separated by a single newline, so it's a separate line in the *same paragraph*." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here's a line for us to start with.\n", "\n", "This line is separated from the one above by two newlines, so it will be a *separate paragraph*.\n", "\n", "This line is also a separate paragraph, but...\n", "This line is only separated by a single newline, so it's a separate line in the *same paragraph*." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Code and Syntax Highlighting\n", "\n", "Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and Markdown Here -- support syntax highlighting. Markdown Here supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Inline `code` has `back-ticks around` it. " ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-06-23T18:05:28.327090Z", "start_time": "2021-06-23T18:05:28.302680Z" } }, "source": [ "Inline `code` has `back-ticks around` it. " ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2021-06-23T18:06:28.937578Z", "start_time": "2021-06-23T18:06:28.927813Z" } }, "source": [ "Blocks of code are either fenced by lines with three back-ticks ```, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "```javascript\n", "var s = \"JavaScript syntax highlighting\";\n", "alert(s);\n", "```\n", " \n", "```python\n", "s = \"Python syntax highlighting\"\n", "print s\n", "```\n", " \n", "```\n", "No language indicated, so no syntax highlighting. \n", "But let's throw in a tag.\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```javascript\n", "var s = \"JavaScript syntax highlighting\";\n", "alert(s);\n", "```\n", " \n", "```python\n", "s = \"Python syntax highlighting\"\n", "print s\n", "```\n", " \n", "```\n", "No language indicated, so no syntax highlighting. \n", "But let's throw in a tag.\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Tables\n", "\n", "Tables aren't part of the core Markdown spec, but they are part of GFM and Markdown Here supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Colons can be used to align columns.\n", "\n", "| Tables | Are | Cool |\n", "|:------------- |:-------------:| ------:|\n", "| col 3 is | right-aligned | \\$1900 |\n", "| col 2 is | centered | \\$12 |\n", "| col 1 is | left-aligned | \\$1 |\n", "\n", "The outer pipes **`|`** are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.\n", "\n", "Markdown | Less | Pretty\n", "--- | --- | ---\n", "*Still* | `renders` | **nicely**\n", "1 | 2 | 3" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "Colons can be used to align columns.\n", "\n", "| Tables | Are | Cool |\n", "|:------------- |:-------------:| ------:|\n", "| col 3 is | right-aligned | \\$1900 |\n", "| col 2 is | centered | \\$12 |\n", "| col 1 is | left-aligned | \\$1 |\n", "\n", "The outer pipes **`|`** are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.\n", "\n", "Markdown | Less | Pretty\n", "--- | --- | ---\n", "*Still* | `renders` | **nicely**\n", "1 | 2 | 3\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Table - rowspan\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
column 1column 2column 3
row 1 - column 1row 1 - column 2row 1 & 2 - column 3
row 2 - column 1row 2 - column 2
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
column 1column 2column 3
row 1 - column 1row 1 - column 2row 1 & 2 - column 3
row 2 - column 1row 2 - column 2
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Table - colspan\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
column 1column 2column 3
row 1 - column 1row 1 - column 2 & 3
row 2 - column 1row 2 - column 2row 2 - column 3
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
column 1column 2column 3
row 1 - column 1row 1 - column 2 & 3
row 2 - column 1row 2 - column 2row 2 - column 3
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Images" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Images - Representation\n", "\n", "![Title](img/jupyter.png \"description\")\n", "***Image:*** *description*\n", " \n", "![myImage](https://media.giphy.com/media/XRB1uf2F9bGOA/giphy.gif \"description\")\n", "***Image:*** *description*\n", "\n", "\n", "\n", "| | \n", "|:--:| \n", "| **Hi-Five** |\n", "\n", "| ![space-1.jpg](http://www.storywarren.com/wp-content/uploads/2016/09/space-1.jpg) | \n", "|:--:| \n", "| *Space* |\n", "\n", "![Random Unsplash Image](https://source.unsplash.com/random)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2021-06-24T05:55:59.495410Z", "start_time": "2021-06-24T05:55:59.478807Z" } }, "outputs": [], "source": [ "![Title](img/jupyter.png \"description\")\n", "***Image:*** *description*\n", " \n", "![myImage](https://media.giphy.com/media/XRB1uf2F9bGOA/giphy.gif \"description\")\n", "***Image:*** *description*\n", "\n", "\n", "\n", "| | \n", "|:--:| \n", "| **Hi-Five** |\n", "\n", "| ![space-1.jpg](http://www.storywarren.com/wp-content/uploads/2016/09/space-1.jpg) | \n", "|:--:| \n", "| *Space* |\n", "\n", "![Random Unsplash Image](https://source.unsplash.com/random)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Image Align - Middle _(default)_\n", "\n", "Image align to Center. .\n", " " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#### Image Align - Middle _(default)_\n", "\n", "Image align to Center. .\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Image Align - *Left*\n", "\n", "Image align to left\"left.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#### Image Align - *Left*\n", "\n", "Image align to left\"left.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Image Align - *Right*\n", "\n", "\"right\" Image align to right." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#### Image Align - *Right*\n", "\n", "\"right\" Image align to right.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### YouTube Videos\n", "\n", "They can't be added directly but you can add an image with a link to the video like this:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Example:**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Or, in pure Markdown, but losing the image sizing and border:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Example:**" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "[![IMAGE ALT TEXT HERE](img/youtube.png)](https://www.youtube.com/watch?v=w3jLJU7DT5E&ab_channel=GitHub)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[![IMAGE ALT TEXT HERE](img/youtube.png)](https://www.youtube.com/watch?v=w3jLJU7DT5E&ab_channel=GitHub)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### TeX Mathematical Formulae\n", "\n", "A full description of TeX math symbols is beyond the scope of this cheatsheet. Here's a [good reference](https://en.wikibooks.org/wiki/LaTeX/Mathematics), and you can try stuff out on [CodeCogs](https://www.codecogs.com/latex/eqneditor.php). You can also play with formula in the Markdown Here options page.\n", "\n", "Here are some examples to try out:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "![\\Large x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}](https://latex.codecogs.com/svg.latex?\\Large&space;x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![\\Large x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}](https://latex.codecogs.com/svg.latex?\\Large&space;x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}) \n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "![\\Large x=a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+a_4}}}](https://latex.codecogs.com/svg.latex?\\Large&space;x=a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+a_4}}})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![\\Large x=a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+a_4}}}](https://latex.codecogs.com/svg.latex?\\Large&space;x=a_0+\\frac{1}{a_1+\\frac{1}{a_2+\\frac{1}{a_3+a_4}}})" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "![\\Large \\forall x \\in X, \\quad \\exists y \\leq \\epsilon](https://latex.codecogs.com/svg.latex?\\Large&space;\\forall{x}\\in{X},\\quad\\exists{y}\\leq\\epsilon)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![\\Large \\forall x \\in X, \\quad \\exists y \\leq \\epsilon](https://latex.codecogs.com/svg.latex?\\Large&space;\\forall{x}\\in{X},\\quad\\exists{y}\\leq\\epsilon)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here is a simple script to convert the equation into html: https://jsfiddle.net/8ndx694g/\n", "\n", "Step 1: Paste LaTex Equation \n", "\n", " x = a_0 + \\frac{1}{a_1 + \\frac{1}{a_2 + \\frac{1}{a_3 + a_4}}}\n", "\n", "Step 2: Click on \"Econdode to github render URL\"\n", "\n", " \n", "\n", "Step 3: Copy and Paste genrated URL\n", "\n", "" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "$-b \\pm \\sqrt{b^2 - 4ac} \\over 2a$\n", "$x = a_0 + \\frac{1}{a_1 + \\frac{1}{a_2 + \\frac{1}{a_3 + a_4}}}$\n", "$\\forall x \\in X, \\quad \\exists y \\leq \\epsilon$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$-b \\pm \\sqrt{b^2 - 4ac} \\over 2a$\n", "$x = a_0 + \\frac{1}{a_1 + \\frac{1}{a_2 + \\frac{1}{a_3 + a_4}}}$\n", "$\\forall x \\in X, \\quad \\exists y \\leq \\epsilon$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The beginning and ending dollar signs **`$`** are the delimiters for the TeX markup." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "hide_input": false, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.9" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 1 }