{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction to LaTeX\n", "\n", "LaTeX (pronounced *Lay-Tech*) is a document preparation system that creates beautiful documents and makes it easy to write mathematical equations. Nearly all process control, computer science and math research papers are written using $\\LaTeX$ (notice the stylized text, this is done with LaTeX).\n", "\n", "## Why learn LaTeX\n", "\n", "LaTeX allows you to write your content first and handle the document's design later with a programmatic and consistent approach. Recall all your sleepless nights in CHBE, fighting with Microsoft Word over the formatting of your lab reports. LaTeX solves those problems by allowing you to focus on the report's content and generate the final formatted document using a template." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Inline Math vs Display Math\n", "\n", "To write LaTeX in Jupyter, make sure your cell is in Markdown mode first. You can then write LaTeX expressions by enclosing them in single dollar signs. For example, writing `$ax+b=c$` would give you $ax+b=c$. This is called **inline math mode**.\n", "\n", "You can also have your equations on a separate line by enclosing them in double dollar signs. This is called **display math mode**. For example, writing `$$y=mx+b$$` would give you:\n", "\n", "$$ y = mx+b $$\n", "\n", "Try it yourself in the next cell. Remember to switch to Markdown mode!" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exponents and Subscripts\n", "- Write your exponents using the caret sign `^`. For example, `$x^2$` would give you $x^2$.\n", "- Write your subscripts using the underscore sign `_`. For example, `$x_i$` would give you $x_i$.\n", "- If you have multiple terms in your exponents or subscripts, enclose them in curly brackets `{}`. For example `$2^{a+b+c}$` would give you:\n", "\n", "$$2^{a+b+c}$$\n", "\n", "Now you try:" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Symbols\n", "Write your symbols using a backslash and their names. \n", "\n", "### Greeks\n", "For example: `\\alpha`, `\\beta` and `\\gamma` would show up as $\\alpha, \\beta, \\gamma$. Uppercase works too: `\\Phi`, `\\Delta` and `\\Omega`: $\\Phi, \\Delta, \\Omega$\n", "\n", "### Operators\n", "Here are some common ones: \n", "\n", "- Plusminus: `\\pm`, $\\pm$\n", "- Times: `\\times`, $\\times$\n", "- Infinity: `\\infty`, $\\infty$\n", "- Inequalities: `\\leq`, `\\geq`, `\\neq`, $\\leq, \\geq, \\neq$\n", "- Square root: `\\sqrt{25}`, $\\sqrt{25}$\n", "\n", "You can easily Google for the full list of symbols, or check out [this table](http://oeis.org/wiki/List_of_LaTeX_mathematical_symbols)." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fractions\n", "\n", "Write fractions using `\\frac{}{}` with the numerator in the first bracket and the denominator in the second bracket.\n", "\n", "For example, `H(s) = \\frac{1}{2s+1}`:\n", "\n", "$$ H(s) = \\frac{1}{2s+1} $$" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Brackets\n", "\n", "Try adding brackets to the equation above. Notice that they are too small to cover the fraction:\n", "\n", "$$ H(s) = (\\frac{1}{2s+1}) $$\n", "\n", "You can control the size of brackets and parentheses by using `\\big(` and `\\big)`. \n", "\n", "$$ H(s) = \\big(\\frac{1}{2s+1}\\big) $$\n", "\n", "To make it even bigger, use capital Big:\n", "\n", "$$ H(s) = \\Big(\\frac{1}{2s+1}\\Big) $$\n", "\n", "Or even bigger with bigg:\n", "\n", "$$ H(s) = \\bigg(\\frac{1}{2s+1}\\bigg) $$\n", "\n", "and Bigg:\n", "\n", "$$ H(s) = \\Bigg(\\frac{1}{2s+1}\\Bigg) $$" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Integration\n", "\n", "Do integration with `\\int{}`. For example `\\int{f(x)dx}`:\n", "\n", "$$ \\int{f(x)dx} $$\n", "\n", "Set the limits using exponents and underscores:\n", "\n", "$$ \\int^{\\infty}_{-\\infty}{f(x)dx} $$" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Those should be enough to get you started. The best way to learn LaTeX is by practicing.\n", "\n", "- The next time you post a question on Piazza, use LaTeX to type out the equations properly.\n", "- Try typesetting your assignments in LaTeX instead of Microsoft Word." ] } ], "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.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }