{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# Upload Notebook for Examples"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "This notebook is designed to provide examples of different types of outputs that can be used to test the JupyterLab frontend and other Jupyter frontends."
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "source": [
    "from IPython.display import display\n",
    "from IPython.display import (\n",
    "    HTML, Image, Latex, Math, Markdown, SVG\n",
    ")"
   ],
   "outputs": [],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Text"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "Plain text:"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "source": [
    "text = \"\"\"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam urna\n",
    "libero, dictum a egestas non, placerat vel neque. In imperdiet iaculis fermentum. \n",
    "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia \n",
    "Curae; Cras augue tortor, tristique vitae varius nec, dictum eu lectus. Pellentesque \n",
    "id eleifend eros. In non odio in lorem iaculis sollicitudin. In faucibus ante ut \n",
    "arcu fringilla interdum. Maecenas elit nulla, imperdiet nec blandit et, consequat \n",
    "ut elit.\"\"\"\n",
    "print(text)"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam urna\n",
      "libero, dictum a egestas non, placerat vel neque. In imperdiet iaculis fermentum. \n",
      "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia \n",
      "Curae; Cras augue tortor, tristique vitae varius nec, dictum eu lectus. Pellentesque \n",
      "id eleifend eros. In non odio in lorem iaculis sollicitudin. In faucibus ante ut \n",
      "arcu fringilla interdum. Maecenas elit nulla, imperdiet nec blandit et, consequat \n",
      "ut elit.\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "Text as output:"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "source": [
    "text"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam urna\\nlibero, dictum a egestas non, placerat vel neque. In imperdiet iaculis fermentum. \\nVestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia \\nCurae; Cras augue tortor, tristique vitae varius nec, dictum eu lectus. Pellentesque \\nid eleifend eros. In non odio in lorem iaculis sollicitudin. In faucibus ante ut \\narcu fringilla interdum. Maecenas elit nulla, imperdiet nec blandit et, consequat \\nut elit.'"
      ]
     },
     "metadata": {},
     "execution_count": 29
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "Standard error:"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "source": [
    "import sys; print('this is stderr', file=sys.stderr)"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stderr",
     "text": [
      "this is stderr\n"
     ]
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## HTML"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "source": [
    "div = HTML('<div style=\"width:100px;height:100px;background:grey;\" />')\n",
    "div"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ],
      "text/html": [
       "<div style=\"width:100px;height:100px;background:grey;\" />"
      ]
     },
     "metadata": {},
     "execution_count": 31
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "source": [
    "for i in range(3):\n",
    "    print(7**10)\n",
    "    display(div)"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ],
      "text/html": [
       "<div style=\"width:100px;height:100px;background:grey;\" />"
      ]
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ],
      "text/html": [
       "<div style=\"width:100px;height:100px;background:grey;\" />"
      ]
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ],
      "text/html": [
       "<div style=\"width:100px;height:100px;background:grey;\" />"
      ]
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## Markdown"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "source": [
    "md = Markdown(\"\"\"\n",
    "### Subtitle\n",
    "\n",
    "This is some *markdown* text with math $F=ma$.\n",
    "\n",
    "\"\"\")\n",
    "md"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": [
       "\n",
       "### Subtitle\n",
       "\n",
       "This is some *markdown* text with math $F=ma$.\n",
       "\n"
      ]
     },
     "metadata": {},
     "execution_count": 33
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "source": [
    "display(md)"
   ],
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ],
      "text/markdown": [
       "\n",
       "### Subtitle\n",
       "\n",
       "This is some *markdown* text with math $F=ma$.\n",
       "\n"
      ]
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## LaTeX"
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "Examples LaTeX in a markdown cell:\n",
    "\n",
    "\n",
    "\\begin{align}\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{align}"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "source": [
    "math = Latex(\"$F=ma$\")\n",
    "math"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Latex object>"
      ],
      "text/latex": [
       "$F=ma$"
      ]
     },
     "metadata": {},
     "execution_count": 35
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "source": [
    "maxwells = Latex(r\"\"\"\n",
    "\\begin{align}\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{align}\n",
    "\"\"\")\n",
    "maxwells"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.Latex object>"
      ],
      "text/latex": [
       "\n",
       "\\begin{align}\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{align}\n"
      ]
     },
     "metadata": {},
     "execution_count": 36
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "markdown",
   "source": [
    "## SVG"
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "source": [
    "svg_source = \"\"\"\n",
    "<svg width=\"400\" height=\"110\">\n",
    "  <rect width=\"300\" height=\"100\" style=\"fill:#E0E0E0;\" /> \n",
    "</svg>\n",
    "\"\"\"\n",
    "svg = SVG(svg_source)\n",
    "svg"
   ],
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ],
      "image/svg+xml": "<svg height=\"110\" width=\"400\">\n  <rect height=\"100\" style=\"fill:#E0E0E0;\" width=\"300\"/> \n</svg>"
     },
     "metadata": {},
     "execution_count": 41
    }
   ],
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "source": [
    "for i in range(3):\n",
    "    print(10**i)\n",
    "    display(svg)"
   ],
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ],
      "image/svg+xml": "<svg height=\"110\" width=\"400\">\n  <rect height=\"100\" style=\"fill:#E0E0E0;\" width=\"300\"/> \n</svg>"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ],
      "image/svg+xml": "<svg height=\"110\" width=\"400\">\n  <rect height=\"100\" style=\"fill:#E0E0E0;\" width=\"300\"/> \n</svg>"
     },
     "metadata": {}
    },
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "10000000000\n"
     ]
    },
    {
     "output_type": "display_data",
     "data": {
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ],
      "image/svg+xml": "<svg height=\"110\" width=\"400\">\n  <rect height=\"100\" style=\"fill:#E0E0E0;\" width=\"300\"/> \n</svg>"
     },
     "metadata": {}
    }
   ],
   "metadata": {}
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "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.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}